summaryrefslogtreecommitdiff
path: root/v2/src/content/en/pastebins/raku-tuple-type-annotation.md
blob: 6c13b39dc66c4d26b20ed1f59e0137f374e8ed83 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
---

title: Raku tuple type annotation

date: 2019-12-29

categories: raku programming-languages

---

```perl
# Single Str return value: this works
sub f1(Str $in --> Str) {
  $in;
}

# Tuple of Str as return value: this works
sub f2(Str $in) {
  ($in, $in);
}

# Tuple of Str as return value with type annotation: this doesn't works
sub f2(Str $in --> (Str, Str)) {
  ($in, $in);
}
```

Error log is:

```perl
===SORRY!=== Error while compiling /path/to/my/file
Malformed return value
```