@@ -147,19 +147,13 @@ run the block, or it will return the value which the block produces:
147
147
my $c = 0; say (1, (if 1 { $c += 42; 2; }), 3, $c); # says "1 2 3 42"
148
148
my $d = 0; say (1, (if 0 { $d += 42; 2; }), 3, $d); # says "1 3 0"
149
149
150
- Implementation note: Currently, Rakudo will say "1 Nil 3 0" for the last
151
- example because it is not caught up to this part of the design yet.
152
-
153
150
For the statement modifier it is the same, except you have the value
154
151
of the statement instead of a block:
155
152
156
153
say (1, (42 if True) , 2); # says "1 42 2"
157
154
say (1, (42 if False), 2); # says "1 2"
158
155
say (1, 42 if False , 2); # says "1 42" because "if False, 2" is true
159
156
160
- Implementation note: Currently, Rakudo will say "1 Nil 2" for the second
161
- example because it is not caught up to this part of the design yet.
162
-
163
157
The C < if > does not change the topic (C < $_ > ) by default. In order to access
164
158
the value which the conditional expression produced, you have to ask
165
159
for it more strongly:
@@ -231,9 +225,6 @@ or the value produced by the block that did run:
231
225
(if 0 { $d += 42; "two"; } elsif False { $d += 43; 2; }),
232
226
3, $d); # says "1 3 0"
233
227
234
- Implementation note: Currently, Rakudo will say "1 Nil 3 0" for the last
235
- example because it is not caught up to this part of the design yet.
236
-
237
228
It's possible to obtain the value of the previous expression inside an
238
229
C < else > , which could be from C < if > or the last C < elsif > if any are
239
230
present:
0 commit comments