Variables

Variable declaration looks like this:

var x = 42;

We can specify type of variable like this:

var x: int = 42;

Zero initialized variables (undefined)

To create "undefined" variable you need use undefined keyword:

var x: int = undefined;

This code will allocate space in function stack for variable but doesn't initialize x with some value.

Compile-time variables

Jazz allows you declare compile-time variable. You need use comptime keyword before var

comptime var x = 42;

You can't assign to x in non-compile-time context, you should use comptime keyword before assignment:

comptime x = 0;

Last updated