Skip to content

Commit 70ac793

Browse files
authored
Merge pull request #2417 from chsanch/fix-2412
Fix #2412 Add examples for removing SetHash items
2 parents 4cbf1cb + acc80fb commit 70ac793

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

doc/Type/SetHash.pod6

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,19 @@ $fruits<apple kiwi> = False, True;
3535
say $fruits.keys.sort; # OUTPUT: «kiwi orange peach␤»
3636
=end code
3737
38-
Here is a convenient shorthand idiom for adding an element to a SetHash:
38+
Here is a convenient shorthand idiom for adding and removing SetHash elements:
3939
4040
=begin code
4141
my SetHash $fruits .= new;
4242
say $fruits<cherry>; # OUTPUT: «False␤»
4343
$fruits<cherry>++;
4444
say $fruits<cherry>; # OUTPUT: «True␤»
45-
4645
$fruits<apple banana kiwi>»++; # Add multiple elements
46+
47+
$fruits<cherry>--;
48+
say $fruits<cherry>; # OUTPUT: «False␤»
49+
$fruits<banana kiwi>»--; # Remove multiple elements
50+
4751
=end code
4852
4953
=head1 Creating C<SetHash> objects

0 commit comments

Comments
 (0)