diff options
| author | Michael Williamson <mike@zwobble.org> | 2023-07-14 23:05:29 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2023-07-14 23:05:29 +0100 |
| commit | 3ceb2ecab5d2f8d091df271c959a89437175af3f (patch) | |
| tree | 1c835119f55f22d421cc1e8b3296f7dfe1f58551 /examples | |
| parent | 8b4e7af45f229fcce74cd380cc64399bc1d03384 (diff) | |
Add example program for ifs
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/if/shed.toml | 9 | ||||
| -rw-r--r-- | examples/if/src/Counting.shed | 15 |
2 files changed, 24 insertions, 0 deletions
diff --git a/examples/if/shed.toml b/examples/if/shed.toml new file mode 100644 index 00000000..bbbffff5 --- /dev/null +++ b/examples/if/shed.toml @@ -0,0 +1,9 @@ +[shed] +main = "Counting" + +[[shed.bins]] +name = "counting" + +[[shed.examples]] +bin = "counting" +expected-output = "one\ntwo\nmany" diff --git a/examples/if/src/Counting.shed b/examples/if/src/Counting.shed new file mode 100644 index 00000000..060482b5 --- /dev/null +++ b/examples/if/src/Counting.shed @@ -0,0 +1,15 @@ +fun message(count: Int) -> String { + if (count == 1) { + "one\n" + } else if (count == 2) { + "two\n" + } else { + "many\n" + } +} + +fun main() ! Io -> Unit { + print!(message(1)); + print!(message(2)); + print!(message(3)); +} |
