Working on slices, arrays and any types

This commit is contained in:
Krzosa Karol
2022-06-19 20:42:45 +02:00
parent 1a0354213e
commit 367562f0a8
3 changed files with 30 additions and 4 deletions

View File

@@ -1,15 +1,26 @@
main :: (argc: int, argv: **char): int
test_arrays()
test_any()
test_type()
test_arrays :: ()
array1 := []S64{1,2,3,4,5}
array2: []S64 = {0,9,8}
array4 := [][]S64{[]S64{5,6},[]S64{4,3},[]S64{2,3}}
array5 := [][]S64{{5,6},{4,3},{2,3}}
for i := 0, i < length_of(array1), i+=1
assert(i+1 == array1[i])
array6: []*S64 = {&array1[0]}
test_any :: ()
some_int_value := 10
thing: Any = some_int_value
other_any: Any = thing
imp_any := thing
assert(thing.type != Any)
any_array := []Any{some_int_value, thing}
Some_Struct :: struct
thing: int