Skip to content

Commit d98ea87

Browse files
authored
shoe use of empty angle brackets
1 parent 344a51e commit d98ea87

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

doc/Type/Hash.pod6

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,17 @@ The adverb C<:p> returns a C<Pair> or a List of C<Pair> instead of just the valu
654654
The adverbs C<:v> and C<:k> return the key or value or a list their of.
655655
656656
my %h = a => 1, b => 2;
657-
say %h<a>:k; # a
657+
say %h<a>:k; # a
658658
say %h<a b>:k; # (a b)
659659
660+
You can also use the adverbs without knowning anything about the hash by using
661+
empty angle brackets in which case all the keys and values will be listed:
662+
663+
my %h1 = a => 1;
664+
my %h2 = a => 1, b => 2;
665+
say %h1<>:k # (a)
666+
say %h1<>:v # (1)
667+
say %h2<>:k # (a b)
668+
say %h2<>:v # (1 2)
669+
660670
=end pod

0 commit comments

Comments
 (0)