diff options
Diffstat (limited to 'test.toc')
-rw-r--r-- | test.toc | 19 |
1 files changed, 14 insertions, 5 deletions
@@ -1,18 +1,27 @@ #include "std/mem.toc", mem; #include "std/io.toc", io; -main ::= fn() { + +calculation ::= fn() int { + total := 0; i := mem.new(int); *i = 3; - io.puti(*i); ns := mem.news(int, 10); for n, i := &ns { - *n = i; + if i % 2 == 0 { + *n = i; + } } for n := ns { - io.puti(n); + total += n; } + total += *i; mem.del(i); mem.dels(ns); + total } -main(); +main ::= fn() { + io.puti(calculation()); + x ::= calculation(); + io.puti(x); +} |