diff --git a/doc/Language/control.rakudoc b/doc/Language/control.rakudoc index cb5003666..af8347bb1 100644 --- a/doc/Language/control.rakudoc +++ b/doc/Language/control.rakudoc @@ -148,6 +148,18 @@ parenthesize a statement if it is the last thing in an expression: =for code :skip-test 3, if 1 { 2 } ; # Syntax error +As a consequence, C does not run blocks that, by their syntax, must +be functions. For example, if C«->» is used to specify a +L, C treats these as +single-expression statements. + +Thus, adding C«->» to our first example prevents the closure from +being evaluated: + +=for code +# This never dies and never prints "Heads I win, tails I die." +do -> { say "Heads I win, tails I die."; Bool.pick } or die; say "I win."; + =head1 X The simplest way to run a statement or block B is by writing C