Skip to content

Instantly share code, notes, and snippets.

Created November 17, 2014 22:16
Show Gist options
  • Save anonymous/c516537eaa10536cf01f to your computer and use it in GitHub Desktop.
Save anonymous/c516537eaa10536cf01f to your computer and use it in GitHub Desktop.
number_array = [1, 2, 3]
#take each member of number_array and do something with it
# by storing it in the 'number' variable
number_array.each do |number|
puts number
end
#so that is the same as
number = number_array[0]
puts number
number = number_array[1]
puts number
number = number_array[2]
puts number
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment