Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Document the C<loop> statement
... by shamelessly copying the text from the spec....
  • Loading branch information
Paul Cochrane committed Apr 15, 2015
1 parent fb6f481 commit 376253f
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions lib/Language/control.pod
Expand Up @@ -136,11 +136,23 @@ specify a final value for the block.
}
#-> Int
=begin comment
=head2 loop
=end comment
The C<loop> statement is the C-style C<for> loop in disguise:
loop (my $i = 0; $i < 10; $i++) {
...
}
As in C, the parentheses are required if you supply the 3-part spec;
however, the 3-part loop spec may be entirely omitted to write an infinite
loop. That is,
loop {...}
is equivalent to the C-ish idiom:
loop (;;) {...}
=head2 repeat/while, repeat/until
Expand Down

0 comments on commit 376253f

Please sign in to comment.