Skip to content

Instantly share code, notes, and snippets.

@dha
Created September 15, 2015 21:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dha/0a0736b9da74a8e61e49 to your computer and use it in GitHub Desktop.
Save dha/0a0736b9da74a8e61e49 to your computer and use it in GitHub Desktop.
Proposed Perl 6 while/until documentation. Also planning to place this *above* repeat/while and repeat/until
=begin pod
=comment TODO Add docs about LABELs
The C<while> statement executes the block as long as its condition is
true. So
=begin code
my $x = 1;
while $x < 4 {
print $x++;
}
print "\n";
=end code
produces
=begin code
123
=end code
Similarly, the C<until> statement executes the block as long as the
expression is false.
=begin code
my $x = 1;
until $x > 3 {
print $x++;
}
print "\n";
=end code
again produces
=begin code
123
=end code
The condition for C<while> or C<until> can be parenthesized, but there
must be a space between the keyword and the opening parenthesis of the
condition.
Both C<while> and C<until> can be used as statement modifiers. E. g.
=begin code
$x++ while $x < 12
=end code
Also see C<repeat/while> and C<repeat/until> below.
=end pod
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment