Skip to content

Commit f739bcb

Browse files
authored
Merge pull request #1797 from titsuki/add-range-example
Add Shifting and scaling intervals section
2 parents 3c5b34b + c964ce0 commit f739bcb

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

doc/Type/Range.pod6

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@ binding, @-sigiled containers or a slip to get what you mean.
6161
my @range = 0..2;
6262
.say for @numbers[@range]; # OUTPUT: «4␤8␤15␤»
6363
64+
=head2 Shifting and scaling intervals
65+
66+
It is possible to shift or scale the interval of a range:
67+
68+
say (1..10) + 1; # OUTPUT: «2..11␤»
69+
say (1..10) - 1; # OUTPUT: «0..9␤»
70+
say (1..10) * 2; # OUTPUT: «2..20␤»
71+
say (1..10) / 2; # OUTPUT: «0.5..5.0␤»
6472
6573
=head1 Methods
6674

0 commit comments

Comments
 (0)