Reflect

Variables

⚠️ TODO

Mutable Variables

⚠️ TODO

Example:

// infer type from initializer
var x = 2;
x++;
assert(x == 3);

// default initialize
var y: int; // 0 intially
y += 2;
assert (y == 2);

// fully specify the variable
var z: int = 3;

Constant Variables

⚠️ TODO

Constants defined using the let keyword and always have an immutable type. If the initializer of a constant is known at compile-time, it may be used as a meta argument.

Example:

let maxCount = 16;

let pi: double = 3.1415926535897932;

// maxCount can be used at compile-time:
var entries : int[maxCount];