From 0ec80c3a0879b288ed808513af0abc19e37212d7 Mon Sep 17 00:00:00 2001 From: Garrit Franke Date: Sat, 6 Feb 2021 17:27:55 +0100 Subject: [PATCH] Add loops example --- examples/loops.sb | 10 ++++++++++ examples/playground.sb | 8 ++++---- 2 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 examples/loops.sb diff --git a/examples/loops.sb b/examples/loops.sb new file mode 100644 index 0000000..8f58dee --- /dev/null +++ b/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) + } +} \ No newline at end of file diff --git a/examples/playground.sb b/examples/playground.sb index 6bb12eb..7d6084a 100644 --- a/examples/playground.sb +++ b/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) } \ No newline at end of file