aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/hello.sloth18
1 files changed, 18 insertions, 0 deletions
diff --git a/examples/hello.sloth b/examples/hello.sloth
index f4e6692..db71b01 100644
--- a/examples/hello.sloth
+++ b/examples/hello.sloth
@@ -20,3 +20,21 @@ fn testtwo(list: [Int]) Int {
return x;
}
+fn testthree(list: [Int]) Int {
+ var x: Int = vlen(list);
+ return x;
+}
+
+foreign fn testback(x: Int) Void;
+
+fn testfour(list: [Int]) Int {
+ vseti(list, 0, 888);
+ var i: Int = 0;
+ while i < vlen(list) {
+ var value: Int = vgeti(list, i);
+ testback(value);
+ i = i + 1;
+ }
+ return 0;
+}
+