Project

General

Profile

Actions

Bug #6730

closed

last method not really returning last element of range

Added by Anonymous over 12 years ago. Updated over 12 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.2p320 (2012-04-20 revision 35421) [x86_64-darwin10.8.0]
Backport:
[ruby-core:46401]

Description

1.9.2p320 :001 > (0...5).each {|n| p n}
0
1
2
3
4
=> 0...5
1.9.2p320 :002 > (0...5).last(2)
=> [3, 4]
1.9.2p320 :003 > (0...5).last
=> 5
1.9.2p320 :004 >

The last method on line number 003 should return 4

Actions

Also available in: Atom PDF

Like0
Like0