File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -1028,7 +1028,8 @@ for @x -> $x {
1028
1028
1029
1029
prints "1245".
1030
1030
1031
- If the L < C < NEXT > phaser|/language/phasers#NEXT> is present, it runs before the next iteration:
1031
+ If the L < C < NEXT > phaser|/language/phasers#NEXT> is present, it runs
1032
+ before the next iteration:
1032
1033
1033
1034
= begin code
1034
1035
my Int $i = 0;
@@ -1046,6 +1047,19 @@ while ($i < 10) {
1046
1047
# OUTPUT: «1 is odd.3 is odd.5 is odd.7 is odd.9 is odd.»
1047
1048
= end code
1048
1049
1050
+ In a L < whenever|/language/concurrency#index-entry-whenever-whenever >
1051
+ block C < next > immediately exits the block for the current value:
1052
+
1053
+ react {
1054
+ whenever Supply.interval(1) {
1055
+ next if .is-prime;
1056
+ say $_;
1057
+ done if $_ == 4;
1058
+ }
1059
+ }
1060
+
1061
+ prints "0", "1" and "4" - integers from 0 to 4 with primes skipped.
1062
+
1049
1063
*Since version 6.d, the C < next > command in a loop that collects its last statement values
1050
1064
returns C < Empty > for the iterations they run on.*
1051
1065
You can’t perform that action at this time.
0 commit comments