summaryrefslogtreecommitdiff
path: root/test.toc
diff options
context:
space:
mode:
Diffstat (limited to 'test.toc')
-rw-r--r--test.toc33
1 files changed, 31 insertions, 2 deletions
diff --git a/test.toc b/test.toc
index cce5421..b68da85 100644
--- a/test.toc
+++ b/test.toc
@@ -4,13 +4,42 @@ puti @= fn(x: int) {
");
};
+putf @= fn(x: float) {
+ #C("printf(\"%f\\n\", (double)x);
+");
+};
main @= fn() {
- each i := 1..10 {
+ each i := 1..4 {
puti(i);
}
- each i := 10,-1..1 {
+ 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, 10);
+ each _, i := foo {
+ foo[i] = i;
+ };
+ each x := foo {
+ puti(x);
+ }
+ each _ := foo {
+ #C("puts(\"Hello!\")");
+ }
+ bar : [10]int;
+ each _, i := foo {
+ bar[i] = i*i*i;
+ };
+ each x := bar {
+ puti(x);
+ }
+
};