Skip to content

Commit

Permalink
Added code examples to a few methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan-Olof Hendig committed Sep 22, 2016
1 parent b04cf9d commit 2061fa7
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions doc/Type/Range.pod6
Original file line number Diff line number Diff line change
Expand Up @@ -71,44 +71,66 @@ binding, @-sigiled containers or a slip to get what you mean.
Returns the start point of the range.
say (1..5).min; # 1
say (1^..^5).min; # 1
=head2 method excludes-min
method excludes-min(Range:D:) returns Bool:D
Returns C<True> if the start point is excluded from the range, and C<False>
otherwise.
say (1..5).excludes-min; # False
say (1^..^5).excludes-min; # True
=head2 method max
method max(Range:D:)
Returns the end point of the range.
say (1..5).max; # 5
say (1^..^5).max; # 5
=head2 method excludes-max
method excludes-max(Range:D:) returns Bool:D
Returns C<True> if the end point is excluded from the range, and C<False>
otherwise.
say (1..5).excludes-max; # False
say (1^..^5).excludes-max; # True
=head2 method bounds
method bounds(Range:D:) returns Positional
Returns a list consisting of the start and end point.
say (1..5).bounds; # (1 5)
say (1^..^5).bounds; # (1 5)
=head2 method infinite
method infinite(Range:D:) returns Bool:D
Returns C<True> if either end point was declared with C<Inf> or C<*>.
say (1..5).infinite; # False
say (1..*).infinite; # True
=head2 method is-int
method is-int(Range:D:) returns Bool:D
Returns C<True> if both end points are C<Int> values.
say ('a'..'d').is-int; # False
say (1..^5).is-int; # True
say (1.1..5.5).is-int; # False
=head2 method int-bounds
method bounds(Range:D:) returns Positional
Expand Down

0 comments on commit 2061fa7

Please sign in to comment.