From 89394d0fab076765b637b0fe643d8f8950639817 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 2 Feb 2025 20:13:05 +0000 Subject: Add int arithmetic example --- .../18-struct-positional-fields/src/HelloWorld.shed | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 examples/18-struct-positional-fields/src/HelloWorld.shed (limited to 'examples/18-struct-positional-fields/src') diff --git a/examples/18-struct-positional-fields/src/HelloWorld.shed b/examples/18-struct-positional-fields/src/HelloWorld.shed new file mode 100644 index 00000000..8880c7e2 --- /dev/null +++ b/examples/18-struct-positional-fields/src/HelloWorld.shed @@ -0,0 +1,17 @@ +pub fun main() ! Io -> Unit { + val messageParts = getMessageParts(); + print!(messageParts.part1); + print!(messageParts.part2); +} + +// We put part2 before part1 so that the order of args differs from the lexical +// field order. +struct MessageParts( + part2: String, + part1: String, +) { +} + +fun getMessageParts() -> MessageParts { + MessageParts("world\n", "hello, ") +} -- cgit v1.2.3