aboutsummaryrefslogtreecommitdiff
path: root/examples/18-struct-positional-fields/src/HelloWorld.shed
blob: 8880c7e26ae2e935938660af5d28ac303e308cc1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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, ")
}