aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorCody <cody@codyq.dev>2023-06-26 17:12:55 -0500
committerCody <cody@codyq.dev>2023-06-26 17:12:55 -0500
commit00e423d30edf38a5e57c5c1c52cdb323c62850bc (patch)
tree0c7c44cd319ee0b1a15c9b3e42813afb2a938fb1 /examples
parent4172dc213f88df5025169fa7f43d02f2794fdd70 (diff)
downloadsloth-00e423d30edf38a5e57c5c1c52cdb323c62850bc.tar.gz
vpop & function args
Diffstat (limited to 'examples')
-rw-r--r--examples/hello.sloth15
1 files changed, 13 insertions, 2 deletions
diff --git a/examples/hello.sloth b/examples/hello.sloth
index 1bbdbd4..f4e6692 100644
--- a/examples/hello.sloth
+++ b/examples/hello.sloth
@@ -1,11 +1,22 @@
-fn test() [Int 3] {
- var list: [Int 3] = [500, 5, 7];
+fn test() [Int] {
+ var list: [Int] = [500, 5, 7];
vpushi(list, 3);
vpushi(list, 3);
vpushi(list, 3);
vpushi(list, 5);
+ var x: Int = vpopi(list);
+ vpushi(list, x);
+ vpushi(list, x * 2);
+ vpushi(list, x * 3);
+
return list;
}
+fn testtwo(list: [Int]) Int {
+ #vpopi(list);
+ var x: Int = vpopi(list);
+ return x;
+}
+