From 8511c3f02f4afbc32856e2169f083b6197d430a5 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Thu, 28 Sep 2023 15:14:15 +0100 Subject: Add structs example --- examples/14-structs/src/HelloWorld.shed | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 examples/14-structs/src/HelloWorld.shed (limited to 'examples/14-structs/src') 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") +} -- cgit v1.2.3