Must force a type when dealing with compound types

This commit is contained in:
2022-08-22 14:27:41 +01:00
parent 300f8e382b
commit 5b82ed8e45
4 changed files with 26 additions and 13 deletions

View File

@@ -118,6 +118,16 @@ var t: type = int;
var u: t = 42;
```
To force a type instead of an array, use the `type` keyword:
```
var a = [type type]; //array of types
var b = type [type]; //type of array of types
var c = [type]; //error!
var d = b; //types can be re-assigned to other variables
```
## Const
The "const" keyword can be appended to the type of a variable to fix the value in place - constants, as they're known, can't be changed once they are given a value at declaration.