thp-lang.org/md/learn/data-structures/tuples.md

22 lines
236 B
Markdown
Raw Normal View History

2023-10-02 01:41:38 +00:00
# Tuples
2024-03-13 17:16:29 +00:00
Uses `#()` just to avoid confusion with function calls and grouping (`()`).
2023-10-02 01:41:38 +00:00
## Definition
```thp
2024-02-20 10:17:21 +00:00
val person = #("John", "Doe", 32)
2023-10-02 01:41:38 +00:00
2024-02-20 10:17:21 +00:00
val #(name, surname, age) = person
2023-10-02 01:41:38 +00:00
```
## Signature
```thp
#(String, String, Int)
```