Init new repository
This commit is contained in:
21
tests/defer_order.txt
Normal file
21
tests/defer_order.txt
Normal file
@@ -0,0 +1,21 @@
|
||||
i := 0;
|
||||
a: [4]int;
|
||||
test :: proc() {
|
||||
defer {a[i] = 1; i += 1;}
|
||||
defer {a[i] = 2; i += 1;}
|
||||
defer {a[i] = 3; i += 1;}
|
||||
defer {a[i] = 4; i += 1;}
|
||||
}
|
||||
|
||||
main :: proc(): int {
|
||||
test();
|
||||
|
||||
i1 := a[0] == 4;
|
||||
i2 := a[1] == 3;
|
||||
i3 := a[2] == 2;
|
||||
i4 := a[3] == 1;
|
||||
|
||||
result := i1 + i2 + i3 + i4;
|
||||
result -= 4;
|
||||
return :int(result);
|
||||
}
|
||||
Reference in New Issue
Block a user