ruby for each in array code example
Example 1: ruby each array
a = [ "a", "b", "c" ]
a.each {|x| print x, " -- " }
Example 2: iterate over array ruby
# For Ruby
arr = ['a', 'b', 'c']
arr.each { |item| puts item }
a = [ "a", "b", "c" ]
a.each {|x| print x, " -- " }
# For Ruby
arr = ['a', 'b', 'c']
arr.each { |item| puts item }