develooper Front page | perl.perl6.users | Postings from October 2018

need --> help

Thread Next
ToddAndMargo via perl6-users
October 12, 2018 19:32
need --> help
Message ID:
Hi All,

Why does this work

     $ p6 'sub RtnOrd( Str $Char --> Int ){return ord($Char)}; say 
RtnOrd "A";'

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,

No pointy:

$ p6 'sub RtnOrd( Str $Char ){return $Char, ord($Char)}; say RtnOrd "A";'
(A 65)

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About