1 Variable Definition and Type Notation
Sasha Koshka edited this page 2022-08-24 05:45:14 +00:00

In ARF, variables are defined using the syntax name:Type:qualifier, where name is a name token and type is either just a name token describing what type it is, or a pointer to a value of that type or an array to a value of that type. The only supported qualifier is :mut, which marks the variable's data as mutable. Variables are immutable by default.

Pointers are defined like name:{Type} and arrays are defined like name:{Type length} where length is an unsigned integer literal or an ellipsis token (..). If an integer token is given, the length of the array is static, and if an ellipsis is given, the length is dynamic and can be changed at runtime.

Variables can be defined wherever they are used. For example, set x:Int 5 defines a variable of type Int and sets it to 5.