aboutsummaryrefslogtreecommitdiff
path: root/examples/hello.sloth
diff options
context:
space:
mode:
authorCody <cody@codyq.dev>2023-06-29 03:23:35 -0500
committerCody <cody@codyq.dev>2023-06-29 03:23:35 -0500
commitee2133a13d61b3b3fb8fcf88f9c9781debd77d9e (patch)
tree66c6a075f732e4feabfa57e0e188bc52f55051af /examples/hello.sloth
parentc8a987daefa1475b1902b9823e8d2ef4500943cd (diff)
downloadsloth-ee2133a13d61b3b3fb8fcf88f9c9781debd77d9e.tar.gz
For loops
Diffstat (limited to 'examples/hello.sloth')
-rw-r--r--examples/hello.sloth18
1 files changed, 3 insertions, 15 deletions
diff --git a/examples/hello.sloth b/examples/hello.sloth
index 8f42051..5aa54e9 100644
--- a/examples/hello.sloth
+++ b/examples/hello.sloth
@@ -1,19 +1,7 @@
fn main() Int {
- var x: [Int] = [5];
- vpopi(x);
- var i: Int = 0;
- while i < 100 {
- vpushi(x, randGen(0, 100));
- i = i + 1;
+ var i: Int = 10;
+ for j in 0..i {
+ print(istr(j));
}
-
- var y: Int = vgeti(x, 42);
- var y: Int = vgeti(x, 45);
- var y: Int = vgeti(x, 41);
- var y: Int = vgeti(x, 49);
- println(istr(y));
-
-
- print("Hello World\n");
return 0;
}