On 10/12/18 3:27 PM, Curt Tilmes wrote:


On Fri, Oct 12, 2018 at 6:23 PM ToddAndMargo via perl6-users <perl6-users@perl.org <mailto:perl6-users@perl.org>> wrote:

    Is there any way to say I am return two things: a string and an integer?


You can only return one thing, but that one thing can be a List that has a string and an integer in it.


So basically

   return $Char, ord($Char)

returns a list and

   ( my Str $X, my Int $y ) =  RtnOrd "A";

converts it back to a Str and an Int from a List?

For instance:
$ p6 'sub RtnOrd( Str $Char --> List ){return $Char, ord($Char)}; ( my Str $x, my Int $y ) = RtnOrd "A"; say "$x $y";'
   A 65

Reply via email to