Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Explain repeat {} while/until block
Closes #688
  • Loading branch information
zoffixznet committed Jul 11, 2016
1 parent 4488e4e commit 3df7839
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions doc/Language/control.pod6
Expand Up @@ -670,26 +670,15 @@ All these forms may produce a return value the same way C<loop> does.
=head1 X<repeat/while, repeat/until|control flow,repeat>
Perl 5 allows one to apply a statement modifier to a C<do> block such that
C-like constructs such as
do {
...
} while $x < 10; # allowed in Perl 5; not in Perl 6
are possible.
This is specifically disallowed in Perl 6. Nevertheless, one can repeat a
block up to a given condition in the same way with a C<repeat> loop:
Executes the block I<at least once> and, if the condition allows, repeats
that execution.
repeat {
...
# Execute this block. Then, execute it again and again, until $x >= 10
} while $x < 10;
This can also be written quite naturally with C<until>:
repeat {
...
# Execute this block. Then, execute it again and again, while $x < 10
} until $x >= 10;
All these forms may produce a return value the same way C<loop> does.
Expand Down

0 comments on commit 3df7839

Please sign in to comment.