Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #132 from dha/master
Added docs for C<while> and C<until> in control.pod
  • Loading branch information
jonathanstowe committed Oct 8, 2015
2 parents 894232a + 2523914 commit 7421597
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
58 changes: 58 additions & 0 deletions doc/Language/control.pod
Expand Up @@ -452,6 +452,64 @@ is equivalent to the C-ish idiom:
loop (;;) {...}
=head2 while, until
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.
=head2 repeat/while, repeat/until
Perl 5 allows one to apply a statement modifier to a C<do> block such that
Expand Down
5 changes: 5 additions & 0 deletions doc/Type/Int.pod
Expand Up @@ -36,6 +36,11 @@ Usage:
Returns a one-character string, by interpreting the integer as a Unicode
codepoint number and converting it the corresponding character.
Example:
65.chr # returns "A"
196.chr # returns "Ä"
=head2 routine expmod
Defined as:
Expand Down

0 comments on commit 7421597

Please sign in to comment.