ruby loop throgh arrays code example
Example 1: iterate over array ruby
# For Ruby
arr = ['a', 'b', 'c']
arr.each { |item| puts item }
Example 2: ruby iterate over array
# For Ruby
arr = ['a', 'b', 'c']
arr.each do |item|
puts item
end
# For Ruby
arr = ['a', 'b', 'c']
arr.each { |item| puts item }
# For Ruby
arr = ['a', 'b', 'c']
arr.each do |item|
puts item
end