mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
Must force a type when dealing with compound types
This commit is contained in:
10
docs/spec.md
10
docs/spec.md
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user