Browse Source

Add loops example

github-actions
Garrit Franke 1 year ago
parent
commit
0ec80c3a08
  1. 10
      examples/loops.sb
  2. 8
      examples/playground.sb

10
examples/loops.sb

@ -0,0 +1,10 @@
fn main() {
let arr = ["One", "Two", "Three"]
for x in arr {
println(x)
}
for fruit in ["Apple", "Strawberry", "Orange"] {
println(fruit)
}
}

8
examples/playground.sb

@ -1,7 +1,7 @@
fn main() {
let x = ["Foo", "Bar"]
another_function(5)
}
for i in x {
println(i)
}
fn another_function(x: int) {
println(x)
}
Loading…
Cancel
Save