On Tue, Jan 21, 2020 at 18:34 Todd Chester via perl6-users <
perl6-us...@perl.org> wrote:

> On 2020-01-21 16:09, Todd Chester via perl6-users wrote:
> >> 4) A block (that is the { ... } bit) will always 'return' the last
> >> expression evaluated.
> >
> > Seems to me I have see the last expression returned even without
> > the {...}.  Maybe I am misremembering.


Todd, the {} is the block defining the subroutine.

 > sub AplusB( $a, $b --> Int ){$a+$b;}


The above is the sub's definition.

>

> &AplusB


The above should generate an error because the mandatory args are missing,
depending on the context (don't quote me on that).

 > AplusB 2, 3
> 5
>
The above shows the sub being called with the required two args, and the 5
is the returned value which is probably shown in the REPL since there is no
semicolon after the call and the 5 is not usually seen otherwise.

As usual, you are a bit sloppy in your email text so it's not clear exactly
what you are doing and what the real result is and in what context the
question or statement is being shown.

-Tom

Reply via email to