L
Li Chen
Hi all,
I try to use #drop to remove several elements from an array but it
doesn't work.
I check "ri Array.drop" and get no info about #drop. But I see this info
described in http://www.ruby-doc.org/core/classes/Array.html#M000343
ary.drop(n) => array
Drops first n elements from ary, and returns rest elements in an array.
a = [1, 2, 3, 4, 5, 0]
a.drop(3) # => [4, 5, 0]
I wonder what is going on.
Thank you very much,
Li
#########
C:\Documents and Settings\chen73>irb
irb(main):001:0> a=[1,2,3,4]
=> [1, 2, 3, 4]
irb(main):002:0> a.class
=> Array
irb(main):003:0> a.drop(1)
NoMethodError: undefined method `drop' for [1, 2, 3, 4]:Array
from (irb):3
irb(main):004:0> a.drop(2)
NoMethodError: undefined method `drop' for [1, 2, 3, 4]:Array
from (irb):4
irb(main):005:0>
#########
C:\Documents and Settings\chen73>ri Array.drop
Nothing known about Array.drop
I try to use #drop to remove several elements from an array but it
doesn't work.
I check "ri Array.drop" and get no info about #drop. But I see this info
described in http://www.ruby-doc.org/core/classes/Array.html#M000343
ary.drop(n) => array
Drops first n elements from ary, and returns rest elements in an array.
a = [1, 2, 3, 4, 5, 0]
a.drop(3) # => [4, 5, 0]
I wonder what is going on.
Thank you very much,
Li
#########
C:\Documents and Settings\chen73>irb
irb(main):001:0> a=[1,2,3,4]
=> [1, 2, 3, 4]
irb(main):002:0> a.class
=> Array
irb(main):003:0> a.drop(1)
NoMethodError: undefined method `drop' for [1, 2, 3, 4]:Array
from (irb):3
irb(main):004:0> a.drop(2)
NoMethodError: undefined method `drop' for [1, 2, 3, 4]:Array
from (irb):4
irb(main):005:0>
#########
C:\Documents and Settings\chen73>ri Array.drop
Nothing known about Array.drop