Skip to content

Commit

Permalink
Note that AT-POS on Range objects returns Nil
Browse files Browse the repository at this point in the history
  • Loading branch information
Altai-man committed Mar 8, 2019
1 parent 3812880 commit 8bb51f8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions doc/Type/Range.pod6
Expand Up @@ -49,6 +49,16 @@ Use C<∞> or C<*> (Whatever) to indicate an end point to be open-ended.
for 1..* { .say }; # start from 1, continue until stopped
for 1..∞ { .say }; # the same
Ranges implement L<Positional|/type/Positional> interface,
so its elements can be accessed using an index. In a case when the index given
is bigger than the Range object's size, L<Nil|/type/Nil> object will be returned.
The access works for lazy Range objects as well.
=for code
say (1..5)[1]; # OUTPUT: «2␤»
say (1..5)[10]; # OUTPUT: «Nil␤»
say (1..*)[10]; # OUTPUT: «11␤»
=head2 Ranges in subscripts
A Range can be used in a subscript to get a range of values. Please note that
Expand Down

0 comments on commit 8bb51f8

Please sign in to comment.