Skip to content

Commit c9222df

Browse files
committed
Update Range.int-bounds doc
Reflects the tightened implementation.
1 parent a81f8c0 commit c9222df

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

doc/Type/Range.pod6

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ Returns C<True> if both end points are C<Int> values.
245245
246246
proto method int-bounds(|)
247247
multi method int-bounds()
248-
multi method int-bounds($from is rw, $to is rw)
248+
multi method int-bounds($from is rw, $to is rw --> Bool:D)
249249
250250
If the C<Range> is an integer range (as indicated by L<is-int|/routine/is-int>), then this
251251
method returns a list with the first and last value it will iterate over
@@ -256,11 +256,15 @@ Failure if it is not an integer range.
256256
say (2..^5).int-bounds; # OUTPUT: «(2 4)␤»
257257
258258
If called with (writable) arguments, these will take the the values of the
259-
higher and lower bound:
260-
261-
(3..5).int-bounds( my $min, my $max);
262-
say "$min, $max" ; # OUTPUT: «3, 5␤»
263-
259+
higher and lower bound and returns whether integer bounds could be determined
260+
from the C<Range>:
261+
262+
if (3..5).int-bounds( my $min, my $max) {
263+
say "$min, $max" ; # OUTPUT: «3, 5␤»
264+
}
265+
else {
266+
say "Could not determine integer bounds";
267+
}
264268
265269
=head2 method minmax
266270

0 commit comments

Comments
 (0)