summaryrefslogtreecommitdiff
path: root/tiger-compiler/tests/good/managing_values.tig
blob: 231f9f40c8385ce5f552c5557d7f17f865dba166 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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