P
Potato Peelings
Ruby version : 1.9.1.376
OS : Windows
I'm checking http://ruby-doc.org/core/classes/Array.html#M002161 (Array
element assignment) which says
...If nil is used in the second and third form, *deletes* elements
from self...
with the example
a[1..-1] = nil #=> ["A"]
This doesn't seem to agree with how Ruby works now. puts a.to_s gives me
["A", nil]
nil seems to work the way any other assignment would. The splice is just
replaced with the new element.
Am I reading this wrong?
OS : Windows
I'm checking http://ruby-doc.org/core/classes/Array.html#M002161 (Array
element assignment) which says
...If nil is used in the second and third form, *deletes* elements
from self...
with the example
a[1..-1] = nil #=> ["A"]
This doesn't seem to agree with how Ruby works now. puts a.to_s gives me
["A", nil]
nil seems to work the way any other assignment would. The splice is just
replaced with the new element.
Am I reading this wrong?