mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
26 lines
547 B
Plaintext
26 lines
547 B
Plaintext
//basic types
|
|
var t: type = int;
|
|
var u: t = 42;
|
|
|
|
assert t == int, "types are not first class";
|
|
assert u == 42, "first-class types are screwing with values";
|
|
|
|
|
|
//differentiate by the "type" value
|
|
var v: type = type [int];
|
|
var w = [int];
|
|
var x = v;
|
|
|
|
assert w == [int], "defining an array of types failed";
|
|
assert x == type [int], "re-assigning a type value failed";
|
|
|
|
//complex type
|
|
var complex: type = type [string, [int]];
|
|
var dict: complex = [
|
|
"first array": [1, 2, 3],
|
|
"second array": [4, 5, 6],
|
|
"third array": [7, 8, 9]
|
|
];
|
|
|
|
print "All good";
|