diff options
Diffstat (limited to 'tests/misc.toc')
-rw-r--r-- | tests/misc.toc | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/misc.toc b/tests/misc.toc new file mode 100644 index 0000000..d66972f --- /dev/null +++ b/tests/misc.toc @@ -0,0 +1,27 @@ +#include "io.toc", io; + +arr_sum ::= fn(n::=, t::=, a:[n]t) t { + total := 0 as t; + for x := a { + total += x; + } + total +}; + +mk_arr ::= fn(x:int, y:int, z:int) a:[3]int { + a[0] = x; + a[1] = y; + a[2] = z; +}; + +main ::= fn() { + x ::= 3; + #if x > 2 { + io.puts("Hello!"); + } else { + foo("yes"); + } + io.puti(arr_sum(mk_arr(5,89,22))); + io.puti(arr_sum(mk_arr(1,2,3))); + io.puti(arr_sum(mk_arr(z=0, 0, 0))); +};
\ No newline at end of file |