Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Extend Pair description
  • Loading branch information
Altai-man committed Mar 8, 2019
1 parent eac6eda commit 64c55d4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions doc/Type/Pair.pod6
Expand Up @@ -97,12 +97,16 @@ $pair.say; # OUTPUT: «a => value B␤»
=end code
As Pair implements L<Associative|/type/Associative> role, its value can be
accessed using Associative subscription operation. Subscrip adverbs work as well.
accessed using Associative subscription operator, however, due to X<Pair>'s
singular nature, the pair's value will be only returned for the pair's key.
L<Nil|/type/Nil> object will be returned for any other key. Subscript
adverbs such as X<:exists> can be used on Pair.
=for code
my $pair = a => 5;
say $pair<a>; # OUTPUT: «5␤»
say $pair<a>:exists; # OUTPUT: «True␤»
say $pair<a>; # OUTPUT: «5␤»
say $pair<a>:exists; # OUTPUT: «True␤»
say $pair<no-such-key>; # OUTPUT: «Nil␤»
=head1 Methods
Expand Down

0 comments on commit 64c55d4

Please sign in to comment.