File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -97,12 +97,16 @@ $pair.say; # OUTPUT: «a => value B»
97
97
= end code
98
98
99
99
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.
101
104
102
105
= for code
103
106
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»
106
110
107
111
= head1 Methods
108
112
You can’t perform that action at this time.
0 commit comments