We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ed1df4c commit 2b9cbcfCopy full SHA for 2b9cbcf
doc/Language/control.pod6
@@ -424,9 +424,9 @@ A for loop can produce a C<List> of the values produced by each run of the
424
attached block. To capture these values, put the for loop in parenthesis or
425
assign them to an array:
426
427
- (for 1, 2, 3 { $_ * 2 }).say; # says "(2 4 6)"
428
- my @a = do for 1, 2, 3 { $_ * 2 }; @a.say; # says "[2 4 6]"
429
- my @b = (for 1, 2, 3 { $_ * 2 }); @a.say; # same thing
+ (for 1, 2, 3 { $_ * 2 }).say; # OUTPUT «(2 4 6)»
+ my @a = do for 1, 2, 3 { $_ * 2 }; @a.say; # OUTPUT «[2 4 6]»
+ my @b = (for 1, 2, 3 { $_ * 2 }); @b.say; # OUTPUT: «[2 4 6]»
430
431
=head1 X<gather/take|control flow,gather take>
432
0 commit comments