ignore previous post (it does not work right)
maybe this one,
array = [1,2,3,4,7,4]
=> [1, 2, 3, 4, 7, 4]
del=[1,3]
=> [1, 3]
del.each{|i| array[i]=nil}
=> [1, 3]
array.compact
=> [1, 3, 7, 4]
ignore previous post (it does not work right)
maybe this one,
array = [1,2,3,4,7,4]
=> [1, 2, 3, 4, 7, 4]
del=[1,3]
=> [1, 3]
del.each{|i| array[i]=nil}
=> [1, 3]
array.compact
=> [1, 3, 7, 4]
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs