12:45
deadmarshal_ left
13:27
deadmarshal_ joined
|
|||
antononcube | By accident, I used the operator //= which I cannot find in the documentation. What is its meaning? Is it: > If RHS is not defined, then assign LHS to it my $x=...; $x //= 3; say $x | 15:50 | |
nahita3882 | yes but the other way around | 15:52 | |
if LHS is not defined, assign RHS to it | |||
it expands to this: there is // infix "defined-or" operator; a // b evaluates to a if a has a defined value; otherwise evaluates to b | 15:53 | ||
//= is the augmented assignment form of this operator, i.e., a //= b is equivalent to a = a // b | 15:54 | ||
lizmat | just like a += b is equivalent to a = a + b | ||
nahita3882 | yeah and in augmented cases a would be evaluated once | 15:56 | |
m: sub f is rw { say "here!"; my $ }; say f() //= 500 | 15:58 | ||
Raku eval | here! 500 | ||
antononcube | @nahita3882 Thanks! (And yes I swapped LHS and RHS in my conjecture questions.) | 16:24 | |
librasteve | docs.raku.org/language/operators#A..._operators | 17:42 | |
The aforementioned two differences between the simple and compound assignment statements are briefly elucidated below. ... not sure I like the flowery prose | 17:46 |