mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
[DOC] beginless and endless ranges inspect returns "nil..nil" always
Small correction to the Range docs. All beginless (nil..) and endless (..nil) ranges, as well as fully open ranges (nil..nil), display "nil..nil" when inspected, regardless of their original syntax.
This commit is contained in:
parent
65bc0ec62d
commit
80ab42462e
Notes:
git
2025-03-21 01:30:57 +00:00
1 changed files with 5 additions and 5 deletions
10
range.c
10
range.c
|
@ -2661,14 +2661,14 @@ range_overlap(VALUE range, VALUE other)
|
||||||
* end
|
* end
|
||||||
* a # => [2, 4, 6, 8, 10]
|
* a # => [2, 4, 6, 8, 10]
|
||||||
*
|
*
|
||||||
* A range can be both beginless and endless. For literal beginless, endless
|
* A range can be both beginless and endless. For literal beginless, endless
|
||||||
* ranges, at least the beginning or end of the range must be given as an
|
* ranges, at least the beginning or end of the range must be given as an
|
||||||
* explicit nil value. It is recommended to use an explicit nil beginning and
|
* explicit nil value. It is recommended to use an explicit nil beginning and
|
||||||
* implicit nil end, since that is what Ruby uses for Range#inspect:
|
* end, since that is what Ruby uses for Range#inspect:
|
||||||
*
|
*
|
||||||
* (nil..) # => (nil..)
|
* (nil..) # => (nil..nil)
|
||||||
* (..nil) # => (nil..)
|
* (..nil) # => (nil..nil)
|
||||||
* (nil..nil) # => (nil..)
|
* (nil..nil) # => (nil..nil)
|
||||||
*
|
*
|
||||||
* == Ranges and Other Classes
|
* == Ranges and Other Classes
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue