On Fri, Oct 12, 2018 at 3:32 PM ToddAndMargo via perl6-users
<perl6-users@perl.org <mailto:perl6-users@perl.org>> wrote:
Hi All,
Why does this work
$ p6 'sub RtnOrd( Str $Char --> Int ){return ord($Char)}; say
RtnOrd "A";'
65
But this does not?
$ p6 'sub RtnOrd( Str $Char --> Str, Int ){return $Char,
ord($Char)}; say RtnOrd "A";'
===SORRY!=== Error while compiling -e
Malformed return value (return constraints only allowed at the
end
of the signature)
at -e:1
------> sub RtnOrd( Str $Char --> Str⏏, Int ){return $Char,
ord($Char)}; say R
Many thanks,
-T
No pointy:
$ p6 'sub RtnOrd( Str $Char ){return $Char, ord($Char)}; say RtnOrd
"A";'
(A 65)
On 10/12/18 12:47 PM, Brandon Allbery wrote:
Precedence. `--> (Str, Int)` might work better; right now it can't tell
if you meant that, or intended the usual meaning for a comma which would
separate parameters.
--
brandon s allbery kf8nh
allber...@gmail.com <mailto:allber...@gmail.com>
:'(
$ p6 'sub RtnOrd( Str $Char --> (Str, Int) ){return $Char, ord($Char)};
say RtnOrd "A";'
===SORRY!=== Error while compiling -e
Malformed return value
at -e:1
------> sub RtnOrd( Str $Char -->⏏ (Str, Int) ){return $Char, ord($Char)};
--