Skip to content

Commit 9b1f8c3

Browse files
authored
Merge pull request #2234 from mendel/mention-hyped-infix-assignment-ops-in-traps
mention hyped form of infix assignment ops in traps
2 parents e1642ee + 065c7c5 commit 9b1f8c3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

doc/Language/traps.pod6

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -875,6 +875,12 @@ in mind that C<+=> isn't defined as method on the left hand argument
875875
Here C<@a> is assigned the result of adding C<@a> (which has three elements)
876876
and C<10>; C<13> is therefore placed in C<@a>.
877877
878+
Use the L<hyper form|https://docs.perl6.org/language/operators#Hyper_operators>
879+
of the assignment operators instead:
880+
881+
my @a = 1, 2, 3;
882+
@a »+=» 10;
883+
say @a; # OUTPUT: «[11 12 13]␤»
878884
879885
=head1 Regexes
880886

0 commit comments

Comments
 (0)