Skip to content

Commit 64c55d4

Browse files
authored
Extend Pair description
1 parent eac6eda commit 64c55d4

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

doc/Type/Pair.pod6

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,16 @@ $pair.say; # OUTPUT: «a => value B␤»
9797
=end code
9898
9999
As Pair implements L<Associative|/type/Associative> role, its value can be
100-
accessed using Associative subscription operation. Subscrip adverbs work as well.
100+
accessed using Associative subscription operator, however, due to X<Pair>'s
101+
singular nature, the pair's value will be only returned for the pair's key.
102+
L<Nil|/type/Nil> object will be returned for any other key. Subscript
103+
adverbs such as X<:exists> can be used on Pair.
101104
102105
=for code
103106
my $pair = a => 5;
104-
say $pair<a>; # OUTPUT: «5␤»
105-
say $pair<a>:exists; # OUTPUT: «True␤»
107+
say $pair<a>; # OUTPUT: «5␤»
108+
say $pair<a>:exists; # OUTPUT: «True␤»
109+
say $pair<no-such-key>; # OUTPUT: «Nil␤»
106110
107111
=head1 Methods
108112

0 commit comments

Comments
 (0)