aboutsummaryrefslogtreecommitdiff
path: root/examples/14-structs/src
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-09-28 15:14:15 +0100
committerMichael Williamson <mike@zwobble.org>2023-09-28 15:14:15 +0100
commit8511c3f02f4afbc32856e2169f083b6197d430a5 (patch)
treec3cfad998cac408dceb0081d13a5c11d6c9b0a72 /examples/14-structs/src
parent37623ba6964acf573e100903fbdd1453d69d2e26 (diff)
Add structs example
Diffstat (limited to 'examples/14-structs/src')
-rw-r--r--examples/14-structs/src/HelloWorld.shed15
1 files changed, 15 insertions, 0 deletions
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")
+}