diff options
| author | Michael Williamson <mike@zwobble.org> | 2023-09-28 15:14:15 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2023-09-28 15:14:15 +0100 |
| commit | 8511c3f02f4afbc32856e2169f083b6197d430a5 (patch) | |
| tree | c3cfad998cac408dceb0081d13a5c11d6c9b0a72 /examples/14-structs | |
| parent | 37623ba6964acf573e100903fbdd1453d69d2e26 (diff) | |
Add structs example
Diffstat (limited to 'examples/14-structs')
| -rw-r--r-- | examples/14-structs/shed.toml | 9 | ||||
| -rw-r--r-- | examples/14-structs/src/HelloWorld.shed | 15 |
2 files changed, 24 insertions, 0 deletions
diff --git a/examples/14-structs/shed.toml b/examples/14-structs/shed.toml new file mode 100644 index 00000000..156fa7c6 --- /dev/null +++ b/examples/14-structs/shed.toml @@ -0,0 +1,9 @@ +[shed] +main = "HelloWorld" + +[[shed.bins]] +name = "hello-world" + +[[shed.examples]] +bin = "hello-world" +expected-output = "hello, world" diff --git a/examples/14-structs/src/HelloWorld.shed b/examples/14-structs/src/HelloWorld.shed new file mode 100644 index 00000000..a9263f85 --- /dev/null +++ b/examples/14-structs/src/HelloWorld.shed @@ -0,0 +1,15 @@ +fun main() ! Io -> Unit { + val messageParts = getMessageParts(); + print!(messageParts.part1); + print!(messageParts.part2); +} + +struct MessageParts( + .part1: String, + .part2: String, +) { +} + +fun getMessageParts() -> MessageParts { + MessageParts(.part1 = "hello, ", .part2 = "world\n") +} |
