ruby map over array and call function on each element code example
Example 1: ruby map array
array = ["a", "b", "c"]
array.map { |string| string.upcase }
# ["A", "B", "C"]
Example 2: ruby map
array = [0, 1, 2]
array.map { |number| number }
array = ["a", "b", "c"]
array.map { |string| string.upcase }
# ["A", "B", "C"]
array = [0, 1, 2]
array.map { |number| number }