Skip to content

Instantly share code, notes, and snippets.

@ryanckulp
Last active January 2, 2018 01:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanckulp/ef04e31fd560bae560fc8bdf093d3591 to your computer and use it in GitHub Desktop.
Save ryanckulp/ef04e31fd560bae560fc8bdf093d3591 to your computer and use it in GitHub Desktop.
looping through an array of groceries in Ruby
groceries = ["apple", "pear", "banana"]
groceries.each do |grocery|
puts grocery
end
# =>
# apple
# pear
# banana
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment