Greetings!
When assigning a value to an array as in the following, how could I replace the nils by 0?
nil
0
array = [1,2,3] array
To change the array in place
array.map!{|x|x ?x:0}
If the array can contain false you'll need to use this instead
false
array.map!{|x|x.nil? ? 0:x}