It's fine syntactically, but I think has no effect because it'd be '$v = $v' after the '+|='. Conceivably some future version of rakudo could warn about it having no effect.
On Thu, Oct 4, 2018 at 3:09 PM ToddAndMargo <toddandma...@zoho.com> wrote: > On 10/4/18 12:06 PM, ToddAndMargo wrote: > > On 10/4/18 12:00 PM, JJ Merelo wrote: > >> > >> > >> El jue., 4 oct. 2018 a las 20:58, ToddAndMargo (<toddandma...@zoho.com > >> <mailto:toddandma...@zoho.com>>) escribió: > >> > >> Hi All, > >> > >> I am trying to come up with something like += > >> > >> $ p6 'my $v = 32; $v += 2; say $v;' > >> 34 > >> > >> to replace > >> > >> $ p6 'my $v = 0b00100000; $v = $v +| 0b00010000; say $v;' > >> 48 > >> > >> > >> But I obviously have something wrong: > >> > >> $ p6 'my $v = 0b00100000; $v +| 0b00010000; say $v;' > >> WARNINGS for -e: > >> Useless use of "+|" in expression "$v +| 0b00010000" > >> in sink context (line 1) > >> > >> > >> You are not assigning the result of the operation to anything. > >> > >> say my $v = 0b00100000; $v +|= 0b00010000; say $v; # OUTPUT: > >> «3248» > >> > >> Cheers > >> > >> JJ > > > > > > Hi JJ, > > > > I missed an "=". Thank you! > > > > $ p6 'my $v = 0b00100000; $v = $v +|= 0b00010000; say $v;' > > 48 > > > > $ p6 'my $v = 0b00100000; $v = $v +|= 0b00010001; say $v;' > > 49 > > > > -T > > > > > > > OOOPS!!! I wonder why that did not error out? had an extra `$v =` > > > Corrected: > > $ p6 'my $v = 0b00100000; $v +|= 0b00010001; say $v;' > 49 > > > -- > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Computers are like air conditioners. > They malfunction when you open windows > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > -- brandon s allbery kf8nh allber...@gmail.com