diff options
| author | Michael Williamson <mike@zwobble.org> | 2023-09-16 15:50:46 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2023-09-16 15:50:46 +0100 |
| commit | 904f02af5e2965f73b037e4b3c5d97f57af81987 (patch) | |
| tree | 4a0834906493c9d271e3f5b3b946eea187acfe13 /examples/10-while/src | |
| parent | 4fcb9922d9d6369529b398b09d1021cffeccfd5c (diff) | |
Explicitly order examples
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; + } +} |
