Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
improve examples
  • Loading branch information
gfldex committed Jun 29, 2016
1 parent 3029914 commit 21e3150
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions doc/Type/Range.pod
Expand Up @@ -14,10 +14,10 @@ Ranges are constructed using one of the four possible range operators,
which consist of two dots, and optionally a caret which indicates that
the endpoint marked with it is excluded from the range.
1 .. 5
1^.. 5 # start point excluded
1 ..^5 # end point excluded
1^..^5 # start and end point excluded
1 .. 5 # 1 <= $x <= 5
1^.. 5 # 1 < $x <= 5
1 ..^5 # 1 <= $x < 5
1^..^5 # 1 < $x < 5
The caret is also a prefix operator for constructing numeric ranges
starting from zero:
Expand All @@ -34,6 +34,7 @@ than the end point, the range is considered empty.
for 1..5 { .say } # five iterations
('a' ^..^ 'f').list # 'b', 'c', 'd', 'e'
5 ~~ ^5; # False
4.5 ~~ 0..^5 # True
(1.1..5).list; # (1.1, 2.1, 3.1, 4.1)
Use the C<...> sequence operator to produce lists of elements that
Expand Down

0 comments on commit 21e3150

Please sign in to comment.