Apply a callback to an array
Apply a callback function to each element of an Array
Ruby
#create the array ary = [1,2,3,4,5] #create the function (print the square) def print_square(i) puts i**2 end #ruby ary.each do |i| print_square(i) end # prints 1,4,9,16,25