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