Skip to content

Commit

Permalink
Reflow and correcting some hashrefs
Browse files Browse the repository at this point in the history
  • Loading branch information
JJ committed Aug 22, 2018
1 parent 2b9cbcf commit 0d62665
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions doc/Language/control.pod6
Expand Up @@ -93,7 +93,7 @@ is by writing C<do> before it:
# This dies half of the time
do { say "Heads I win, tails I die."; Bool.pick } or die; say "I win.";
Note that you need a space between the do and the block.
Note that you need a space between the C<do> and the block.
The whole C<do {...}> evaluates to the final value of the block. The block
will be run when that value is needed in order to evaluate the rest of the
Expand Down Expand Up @@ -195,11 +195,10 @@ if 0 { say "no" }; else { say "yes" } ; # syntax error
if 0 { say "no" }
else { say "yes" } ; # says "yes"
Additional conditions may be sandwiched between the C<if> and the
C<else> using C<elsif>. An extra condition will only be evaluated
if all the conditions before it were false, and only the block next to
the first true condition will be run. You can end with an C<elsif>
instead of an C<else> if you want.
Additional conditions may be sandwiched between the C<if> and the C<else> using
C<elsif>. An extra condition will only be evaluated if all the conditions
before it were false, and only the block next to the first true condition will
be run. You can end with an C<elsif> instead of an C<else> if you want.
if 0 { say "no" } elsif False { say "NO" } else { say "yes" } # says "yes"
if 0 { say "no" } elsif True { say "YES" } else { say "yes" } # says "YES"
Expand Down Expand Up @@ -365,7 +364,8 @@ say "foo" when X; # if X is true statement is executed
=head1 X<for|control flow, for>
The C<for> loop iterates over a list, running the statements inside a L<block|/type/Block>
The C<for> loop iterates over a list, running the statements inside a
L<block|/type/Block>
once on each iteration. If the block takes parameters, the elements of the
list are provided as arguments.
Expand All @@ -374,7 +374,7 @@ list are provided as arguments.
for @foo { .print } # same thing, because .print implies a $_ argument
for @foo { 42.print } # prints 42 as many times as @foo has elements
Pointy block syntax or a L<placeholder|/language/variables#The_^_Twigil>
Pointy block syntax or a L<placeholder|/language/variables#The_^_twigil>
may be used to name the parameter, of course.
my @foo = 1..3;
Expand Down Expand Up @@ -465,8 +465,8 @@ For example
# 2
C<gather/take> is scoped dynamically, so you can call C<take> from subs or methods that are called
from within C<gather>:
C<gather/take> is scoped dynamically, so you can call C<take> from subs or
methods that are called from within C<gather>:
sub weird(@elems, :$direction = 'forward') {
my %direction = (
Expand Down Expand Up @@ -681,8 +681,8 @@ run of the attached block if it appears in lists:
my @a = (loop ( my $j = 0; $j++ < 3;) { $j * 2 }); @a.say; # OUTPUT: «[2 4 6]␤»
my @b = do loop ( my $k = 0; $k++ < 3;) { $k * 2 }; @b.say; # same thing
Unlike a C<for> loop, one should not rely on whether returned values are produced
lazily, for now. It would probably be best to use C<eager> to guarantee that a
Unlike a C<for> loop, one should not rely on whether returned values are
produced lazily. It would probably be best to use C<eager> to guarantee that a
loop whose return value may be used actually runs:
sub heads-in-a-row {
Expand Down

0 comments on commit 0d62665

Please sign in to comment.