I have an array:
all_ages = ["11", "9", "10", "8", "9"]
and I want to convert it to an array of integers to hopefully make it easier to add them all together.
Any help greatly appreciated, looking for level one solutions.
>Solution :
all_ages = ["11", "9", "10", "8", "9"]
Code
p all_ages.map(&:to_i).sum
Or
p all_ages.map { |x| x.to_i }.sum
Output
47