diff options
Diffstat (limited to 'src/content/pastebins/2019/12')
-rw-r--r-- | src/content/pastebins/2019/12/29/raku-tuple-type.adoc | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/content/pastebins/2019/12/29/raku-tuple-type.adoc b/src/content/pastebins/2019/12/29/raku-tuple-type.adoc new file mode 100644 index 0000000..3d5ff34 --- /dev/null +++ b/src/content/pastebins/2019/12/29/raku-tuple-type.adoc @@ -0,0 +1,37 @@ +--- + +title: Raku tuple type annotation + +date: 2019-12-29 + +layout: post + +lang: en + +ref: raku-tuple-type-annotation + +--- + +```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 +``` |