Skip to main content

Data Types & Variables

Both concepts cannot be neglected when learning a new programming language. While AssemblyScript is very heavily inspired by TypeScript, there are some important differences, especially when it comes to the data types, that are built in.


Variables can be created as known from JavaScript with the keywords var, let and const. While var shouldn't be used anymore, const is for creating constant variables.

To make values accessible to JavaScript, they can be exported:

export const name: string = 'Max'

To import and use a variable like this in JavaScript:

import { name } from './build/release.js'

console.log('The name is ', name.value)

Data Types

Integer Types

i3232-bit signed integer
u3232-bit unsigned integer
i6464-bit signed integer
u6464-bit unsigned integer
i88-bit signed integer
u88-bit unsigned integer
i1616-bit signed integer
u1616-bit unsigned integer

unsigned = No negative values, signed = Negative values allowed

Float types

f3232-bit float
f6464-bit float


const name: string = 'hello'


const arr = new Array<string>(5)