diff options
Diffstat (limited to 'test.toc')
-rw-r--r-- | test.toc | 32 |
1 files changed, 17 insertions, 15 deletions
@@ -13,28 +13,30 @@ putf @= fn(x: float) { "); }; -foo @= fn() int { - N := 10; +sum @= fn(x: []int, n: int) int { + p := &x[0]; + end := &x[n-1]; + total := 0; + while p <= end { + total = total + *p; + p = p + 1; + } + total +}; + +f @= fn() int { + N @= 10; + numbers := new(int, N); i := 0; while i < N { numbers[i] = i; i = i + 1; } - numbers[5:7][1] + numbers[2:][0] + numbers[:6][3] + sum(numbers, N) }; main @= fn() { - N @= 5; - puti(N); - x : [foo()]int; - puti(foo()); - teststr := "Hello!"; - i := 0; - while i < 5 { - putch(teststr[i]); - i = i + 1; - } - y:int=5+#C("(1<<3)"); - puti(y); + a: [f()]int; + puti(f()); }; |