This project is closed and read-only.
Actions
Bug #1518
closedMatrix#[] Raises NoMethodError for Invalid Index
Bug #1518:
Matrix#[] Raises NoMethodError for Invalid Index
Status:
Closed
Assignee:
Description
=begin
m = Matrix[[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11]]
'
>> m[2,8]
=> nil
>> m[8,2]
NoMethodError: undefined method[]' for nil:NilClass from /usr/lib/ruby/1.9.0/matrix.rb:264:in[]'
from (irb):13
from /usr/bin/irb1.9:12:in `
The #[] accessor for Matrix raises a particularly disconcerting NoMethodError when its passed an index which is out of bounds for the second argument. To be consistent with itself, it should return nil when either index is invalid.
=end
Updated by marcandre (Marc-Andre Lafortune) almost 17 years ago
- Category set to lib
- Assignee set to keiju (Keiju Ishitsuka)
=begin
=end
Updated by keiju (Keiju Ishitsuka) almost 17 years ago
- Status changed from Open to Closed
=begin
=end
Actions