summaryrefslogtreecommitdiff
path: root/test.toc
diff options
context:
space:
mode:
Diffstat (limited to 'test.toc')
-rw-r--r--test.toc67
1 files changed, 9 insertions, 58 deletions
diff --git a/test.toc b/test.toc
index 347eb5a..689b4fe 100644
--- a/test.toc
+++ b/test.toc
@@ -9,69 +9,20 @@ putf @= fn(x: float) {
");
};
-// f @= fn() {
-// each i := 1..4 {
-// puti(i);
-// }
-// each i := 4,-1..1 {
-// puti(i);
-// }
-// each i := 1.0..4.0 {
-// putf(i);
-// }
-// each i := 7.0,-1..4.0 {
-// putf(i);
-// }
-// // each i := 0.0,-3.0.. { putf(i); }
-// foo := new(int, 3);
-// each _, i := foo {
-// foo[i] = i;
-// };
-// each x := foo {
-// puti(x);
-// }
-// each _ := foo {
-// #C("puts(\"Hello!\")");
-// }
-// bar : [3]int;
-// each _, i := bar {
-// bar[i] = i*i*i;
-// };
-// each x := bar {
-// puti(x);
-// }
+sum @= fn() int {
-// };
+x := 3;
+total := 0;
+each x := 1..10{
+ total = total + x;
+ total
+}
-g @= fn() int {
- foo : = new(int, 10);
- total := 0;
- // each foo { total = total + 1; }
- each x, i := &foo {
- *x = i;
- };
- each x, i := foo {
- total = total + x * i;
- }
- total
-
- // each i := 1..10 {
- // total = total + i;
- // total
- // }
- // total := 0;
- // each i, j := 1..10 {
- // total = total + i * j;
- // }
- // total
};
main @= fn() {
- puti(g());
- X @= g();
+ puti(sum());
+ X @= sum();
puti(X);
- each i, j := 1..10 {
- puti(i + j);
- }
};