diff options
| author | Martial Simon <msimon_fr@hotmail.com> | 2025-09-15 01:07:58 +0200 |
|---|---|---|
| committer | Martial Simon <msimon_fr@hotmail.com> | 2025-09-15 01:07:58 +0200 |
| commit | 967be9e750221ab2ab783f95df79bb26d290a45e (patch) | |
| tree | 6802900a5e975f9f68b169f0f503f040056d6952 /tiger-compiler/tests/good/managing_values.tig | |
Diffstat (limited to 'tiger-compiler/tests/good/managing_values.tig')
| -rw-r--r-- | tiger-compiler/tests/good/managing_values.tig | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tiger-compiler/tests/good/managing_values.tig b/tiger-compiler/tests/good/managing_values.tig new file mode 100644 index 0000000..231f9f4 --- /dev/null +++ b/tiger-compiler/tests/good/managing_values.tig @@ -0,0 +1,42 @@ +let + var i := 2 + var j := 92 + + function return_1(): int = 1 + function return_i(): int = i + + type ints = array of int + var arr := ints [5] of 0 +in + if (return_1() = 1) then + print("this is indeed equal to 1") + else ( + print("this is not to equal, this is "); + print_int(return_1()) + ); + + print("\n"); + flush(); + + if (j = i) then + print("j is now equal to i") + else ( + print("j is not equal, this is "); + print_int(j) + ); + + print("\n"); + flush(); + + j := return_i(); + + if (j = i) then + print("j is now equal to i") + else ( + print("this is not equal, this is "); + print_int(j) + ); + + print("\n"); + flush() +end |
