Skip to content

Commit ba1af07

Browse files
author
Jan-Olof Hendig
committed
Added docs for Setty.default
1 parent 772b297 commit ba1af07

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

doc/Type/Setty.pod6

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,24 @@ The number of elements of the set.
104104
The total of all the values of the C<QuantHash> object. For a C<Setty>
105105
object, this is just the number of elements.
106106
107+
=head2 method default
108+
109+
Defined as:
110+
111+
method default returns False
112+
113+
Returns the default value of the invocant, i.e. the value which is returned
114+
when trying to access an element in the C<Setty> object which has not been
115+
previously initialized or when accessing an element which has explicitly
116+
been set to C<Nil> or C<False>.
117+
118+
my $s1 = SetHash.new(1, 2, 3);
119+
say $s1{2}; # True
120+
$s1{2} = Nil;
121+
say $s1{2}; # False
122+
# access non initialized element
123+
say $s1{4}; # False
124+
107125
=head2 method ACCEPTS
108126
109127
method ACCEPTS($other)

0 commit comments

Comments
 (0)