Skip to content

Instantly share code, notes, and snippets.

@micedreams
Created November 12, 2023 11:21
Show Gist options
  • Save micedreams/118e8f47bb854c61dc9ddaba03d0d8df to your computer and use it in GitHub Desktop.
Save micedreams/118e8f47bb854c61dc9ddaba03d0d8df to your computer and use it in GitHub Desktop.
hash
friendgame_hash = {}
input = ""
friend = ""
game = ""
puts "Enter name of friend, then their favorite game: or Press Enter to quit"
input = gets.chomp
while input != "" do
puts "Enter name of friend: "
friend = gets.chomp
puts "Enter friends favorite game: "
game = gets.chomp
friendgame_hash[friend] = game
input = gets.chomp
end
puts "Here is the content that was in the hash: "
friendgame_hash.each do |key, value|
puts " #{key} => #{value}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment