Skip to content

Commit 8e673db

Browse files
authored
1 parent c798ff6 commit 8e673db

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

doc/Type/Array.pod6

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,23 @@ Example:
9494
say @a.elems; # OUTPUT: «6␤»
9595
say @a; # OUTPUT: «[a b c d e f]␤»
9696
97+
=head2 method elems
98+
99+
Defined as:
100+
101+
method elems(Array:D: --> Int:D)
102+
103+
Returns the number of elements in the invocant. Throws C<X::Cannot::Lazy>
104+
exception if the invocant L<is lazy|/routine/is-lazy>. For shaped arrays,
105+
returns the outer dimension; see L<shape> if you need information for
106+
all dimensions.
107+
108+
say [<foo bar ber>] .elems; # OUTPUT: «3␤»
109+
say (my @a[42;3;70]).elems; # OUTPUT: «42␤»
110+
111+
try [-∞...∞].elems;
112+
say $!.^name; # OUTPUT: «X::Cannot::Lazy␤»
113+
97114
=head2 method clone
98115
99116
Defined as:

0 commit comments

Comments
 (0)