File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -306,7 +306,7 @@ There are also C<with> and C<without> statement modifiers:
306
306
= head1 X < for|control flow >
307
307
308
308
The C < for > loop iterates over a list, running the statements inside a L < block|/type/Block >
309
- once on each iteration. If the block takes parameters, the elements of the
309
+ once on each iteration. If the block takes parameters, the elements of the
310
310
list are provided as arguments.
311
311
312
312
my @foo = 1..3;
@@ -339,6 +339,12 @@ with missing elements.
339
339
}
340
340
# OUTPUT « 1 2 34 N/A N/A »
341
341
342
+ If the postfix form of C < for > is used a block is not required and the topic is
343
+ set for the statement list.
344
+
345
+ say „I $_ butterflies!“ for <♥ ♥ ♥>;
346
+ # OUTPUT « I ♥ butterflies!I ♥ butterflies!I ♥ butterflies! »
347
+
342
348
A C < for > may be used on lazy lists – it will only take elements from the
343
349
list when they are needed, so to read a file line by line, you could
344
350
use:
You can’t perform that action at this time.
0 commit comments