Fix slice indexing in example

This commit is contained in:
Krzosa Karol
2022-07-28 13:35:47 +02:00
parent b806bafb51
commit d8fda0ff8c
2 changed files with 8 additions and 2 deletions

View File

@@ -33,7 +33,6 @@ main :: (): int
// We set all variables to 1 so
assert(static_array[6] == 1)
// This is how slice is defined, no [] index in between brackets
// slice is array pointer + length
// Other then that it works exactly like regular array
@@ -41,4 +40,11 @@ main :: (): int
// We can't do a compile time assert anymore
assert(length_of(slice) == 8)
assert(slice[4] == 1)
// After we loop and reassign slice values
// old static_array gets changed
for slice
*it = 2
assert(static_array[2] == 2)