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

need --> help

Thread Next
From:
ToddAndMargo via perl6-users
Date:
October 12, 2018 19:32
Subject:
need --> help
Message ID:
b5b71c16-57ad-e762-b79b-5ec7baf0ec0c@zoho.com
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)

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About