Tell me how do you remove nil values in array using ruby?
Answer Posted / Gaurav Krishan
"In Ruby, you can remove all nil elements from an array by calling the compact method on it. Example: arr = [1,nil,2,nil].compact will return [1,2]."
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers