def pad(array, min_size, value = nil)
val_num = array.length - min_size.to_i
if val_num >= 1
p array.push(value*val_num.to_i)
else
p array
end
end
p pad([1,2,3],5, "apple")
I'm trying to figure out why this code wont push the value into a new array, to pad the array. I've been working on this code for a few days, and everytime I try to implement it, it either only runs the original array, or it gives me nil. Is there anything obvious I miss?
val_numand see.