Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
looping through an array of groceries in Ruby
groceries = ["apple", "pear", "banana"]
groceries.each do |grocery|
puts grocery
# =>
# apple
# pear
# banana
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment