From 904f02af5e2965f73b037e4b3c5d97f57af81987 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 16 Sep 2023 15:50:46 +0100 Subject: Explicitly order examples --- examples/10-while/src/Counting.shed | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 examples/10-while/src/Counting.shed (limited to 'examples/10-while/src') 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; + } +} -- cgit v1.2.3