Variables [proposal]

Example variable declaration

Variable must be of one of known Types.

let test = 12
let users: string[] = ['Annie', 'John']

You don't need to declare variable type for basic types like numbers and strings - they are inferred automatically. Type declaration is necessary in complex data structures like Arrays, Sets etc.

Definition

 let <variable_name>: <type>? = <value>

Last updated

Was this helpful?