Answer the question
In order to leave comments, you need to log in
How to remove array elements nicely in ruby?
[{a: 1, b: 1, c: nil}, {a: 1, b: 2, c: 0}, {a: 2, b: 3, c: 4}]
arr = [1, 2, 2, 3]
arr.delete(2) #=> 2
arr #=> [1,3]
arr = {a: 1, b: 1, c: nil}, {a: 1, b: 2, c: 0}, {a: 2, b: 3, c: 4}
arr.delete {a: 1, b: x, c: x}
arr #=> [{a: 2, b: 3, c: 4}]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question