simple-struct.teal 265 Bytes
Newer Older
1
type ABC(a : int, b : int, c : ABC);
2
3
4
5
6
7

fun main() = {
  var x : ABC := new ABC(1, 2, null);
  x := new ABC(3, 4, x);

  var sum : int := 0;
8
  var it : nonnull ABC := x;
9
10
11
12
  while it != null {
    print(it.a);
    sum := sum + it.b;
    it := it.c;
13
14
  }
  return sum;
15
}