diff options
Diffstat (limited to 'examples/10-while/src')
| -rw-r--r-- | examples/10-while/src/Counting.shed | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/examples/10-while/src/Counting.shed b/examples/10-while/src/Counting.shed new file mode 100644 index 00000000..8275fa0c --- /dev/null +++ b/examples/10-while/src/Counting.shed @@ -0,0 +1,18 @@ +fun message(count: Int) -> String { + if (count == 1) { + "one\n" + } else if (count == 2) { + "two\n" + } else { + "many\n" + } +} + +fun main() ! Io -> Unit { + var count = 1; + + while (count != 4) { + print!(message(count)); + assign count := count + 1; + } +} |
