tomo-koans/lesson-templates/lesson-09-text.tm

35 lines
556 B
Plaintext
Raw Normal View History

2025-03-24 19:16:58 -07:00
# Text
func main():
# Text values are sequences of letters.
greeting := "Hello"
>> greeting.length
= ???
# Text supports interpolation with `$`:
name := "Alice"
message := "Hello, $name, your number is $(1 + 2)!"
>> message
= ???
# Multi-line text uses indented quotes:
multiline := "
line one
line two
line three
"
2025-03-24 23:25:54 -07:00
# Method calls use `:`
2025-03-24 19:16:58 -07:00
>> multiline:lines()
= [???]
# Common text methods:
>> "hello":upper()
= ???
>> "hello":split()
= [???]