Skip to content

Commit 72e466e

Browse files
committed
doc Any.push
1 parent 3c04f55 commit 72e466e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

doc/Type/Any.pod

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,18 @@ Interprets the invocant as a list, and returns that L<List|/type/List>.
101101
say 42.list.^name; # List
102102
say 42.list.elems; # 1
103103
104+
=head2 method push
105+
106+
The method push is defined for undefined invocants and allowes to autovivify
107+
undefined to an empty C<Array>, unless the undefined value implements
108+
C<Positional> already. The argument provided will then be pushed into the
109+
newly created Array.
110+
111+
my %h;
112+
dd %h<a>; # Any (and therefor undefined)
113+
%h<a>.push(1); # .push on Any
114+
dd %h; # «Hash %h = {:a($[1])}␤» # please not the Array
115+
104116
=head2 routine reverse
105117
106118
Defined as:

0 commit comments

Comments
 (0)