That would work.

I think it's more idiomatic to write the declaration as:

my (Str $x, Int $y) = ...

which saves repeating the `my`.

--
raiph


On Fri, Oct 12, 2018 at 11:47 PM ToddAndMargo via perl6-users <
[email protected]> wrote:

> On 10/12/18 3:27 PM, Curt Tilmes wrote:
> >
> >
> > On Fri, Oct 12, 2018 at 6:23 PM ToddAndMargo via perl6-users
> > <[email protected] <mailto:[email protected]>> 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