File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -245,7 +245,7 @@ Returns C<True> if both end points are C<Int> values.
245
245
246
246
proto method int-bounds(|)
247
247
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 )
249
249
250
250
If the C < Range > is an integer range (as indicated by L < is-int|/routine/is-int > ), then this
251
251
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.
256
256
say (2..^5).int-bounds; # OUTPUT: «(2 4)»
257
257
258
258
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
+ }
264
268
265
269
= head2 method minmax
266
270
You can’t perform that action at this time.
0 commit comments