diff options
| author | Gustav Sörnäs <gustav@sornas.net> | 2021-01-12 23:35:47 +0100 |
|---|---|---|
| committer | Gustav Sörnäs <gustav@sornas.net> | 2021-01-12 23:35:47 +0100 |
| commit | 4db5a471562130947830ad3edc127a7a994f8e7d (patch) | |
| tree | bf05efc8fd5173e1073e70c8157c63a22bbab6b4 /tests/for.tdy | |
| parent | b9710f5de083e8205dbb51921f43d96b17fd43cf (diff) | |
| download | sylt-4db5a471562130947830ad3edc127a7a994f8e7d.tar.gz | |
test for-loops and scope loop variables
Diffstat (limited to 'tests/for.tdy')
| -rw-r--r-- | tests/for.tdy | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/for.tdy b/tests/for.tdy new file mode 100644 index 0000000..a9f8cd2 --- /dev/null +++ b/tests/for.tdy @@ -0,0 +1,19 @@ +a := 0 +for i := 0, i < 3, i = i + 1 { + a = a + i +} +a <=> 3 + +a = 0 +for i := 0, i <= 3, i = i + 1 { + a = a + i +} +a <=> 6 + +a = 0 +for i := 0, i < 3, i = i + 1 { + for j := 0, j < 3, j = j + 1 { + a = a + i * j + } +} +a <=> 9 |
