how to iterate through arrays ruby code example
Example 1: iterate over array ruby
# For Ruby
arr = ['a', 'b', 'c']
arr.each { |item| puts item }
Example 2: ruby how to loop through an array
array = [1, 2, 3, 4, 5, 6]
array.each { |x| puts x }
# For Ruby
arr = ['a', 'b', 'c']
arr.each { |item| puts item }
array = [1, 2, 3, 4, 5, 6]
array.each { |x| puts x }