Issue #11975 has been reported by Samuel Williams.

----------------------------------------
Bug #11975: Range#last is not consistent and possibly does not do what is expected.
https://bugs.ruby-lang.org/issues/11975

* Author: Samuel Williams
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: 2.3.0
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
The following example demonstrates an inconsistency with Range:

This is expected behaviour:

~~~
(0..10).last => 10
(0..10).to_a.last => 10
~~~

This is unexpected behaviour:

~~~
(0...10).last => 10 # (should be 9?)
(0...10).to_a.last => 9
~~~

I believe that Range#last should give the last valid value for a range. Discussion?



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>