In Functions§

See primary documentation in context for Blocks and lambdas

Whenever you see something like { $_ + 42 }, -> $a, $b { $a ** $b }, or { $^text.indent($:spaces) }, that's Block syntax; the -> is considered also part of the block. Statements such as if, for, while are followed by these kind of blocks.

for 1234 -> $a$b {
    say $a ~ $b;
}
# OUTPUT: «12␤34␤»

They can also be used on their own as anonymous blocks of code.

say { $^a ** 2 + $^b ** 2}(34# OUTPUT: «25␤»

Please note that this implies that, despite the fact that statements such as if do not define a topic variable, they actually can:

my $foo = 33;
if $foo ** 33 -> $a {
    say "$a is not null"# 
} # OUTPUT: «129110040087761027839616029934664535539337183380513 is not null␤» 

For block syntax details, see the documentation for the Block type.