Skip to content

Commit

Permalink
Adjust docs now that '{...} if True' is no longer 'True ?? {...} !! ()'
Browse files Browse the repository at this point in the history
  • Loading branch information
skids committed Apr 28, 2015
1 parent 17b3fbc commit 148b048
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/Language/control.pod
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,15 @@ instead the C<{> and C<}> around the block are mandatory:
There is also a form of C<if> called a "statement modifier" form. In this
case, the if and then the condition come after the code you want to run
conditionally. Also, you should not use the C<{> and C<}>. Do note that the
condition is still always evaluated first:
conditionally. Do note that the condition is still always evaluated first:
43.say if 42.say and 0; # says "42" but does not say "43"
43.say if 42.say and 1; # says "42" and then says "43"
say "It is easier to read code when 'if's are kept on left of screen"
if True; # says the above, because it is true
{ 43.say } if True; # creates a closure, does not run it
{ 43.say } if True; # says "43" as well
The last case is one reason why we have the L<do> keyword. The statement
modifier form is probably best used sparingly.
The statement modifier form is probably best used sparingly.
The C<if> statement itself will either return an empty list, if it does not
run the block, or it will return the value which the block produces:
Expand Down

0 comments on commit 148b048

Please sign in to comment.