Skip to content

Commit

Permalink
Fix Raku#2412 - Add More examples in SetHash
Browse files Browse the repository at this point in the history
Add examples for removing SetHash elements
  • Loading branch information
chsanch committed Oct 24, 2018
1 parent 7af9d67 commit 52a04b7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions doc/Type/SetHash.pod6
Expand Up @@ -35,15 +35,19 @@ $fruits<apple kiwi> = False, True;
say $fruits.keys.sort; # OUTPUT: «kiwi orange peach␤»
=end code
Here is a convenient shorthand idiom for adding an element to a SetHash:
Here is a convenient shorthand idiom for adding and removing elements to a SetHash:
=begin code
my SetHash $fruits .= new;
say $fruits<cherry>; # OUTPUT: «False␤»
$fruits<cherry>++;
say $fruits<cherry>; # OUTPUT: «True␤»
$fruits<apple banana kiwi>»++; # Add multiple elements
$fruits<cherry>--;
say $fruits<cherry>; # OUTPUT: «False␤»
$fruits<banana kiwi>»-- # Remove multiple elements
=end code
=head1 Creating C<SetHash> objects
Expand Down

0 comments on commit 52a04b7

Please sign in to comment.