-
-
Save anonymous/46ddeaa416d5ce0fe905 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
books = { | |
Wheel_of_Time: 6, | |
Mistborn: 5, | |
Alchemist: 7, | |
} | |
puts "What would you like to do? Options: (add) (update) (delete) (list)" | |
choice = gets.chomp | |
case choise | |
when "add" | |
puts "What book would you like to add to your hash?" | |
title = gets.chomp | |
if book[title.to_sym] = .nil? | |
puts "What rating do you give this book? (Between 1 and 10)" | |
rating = gets.chomp | |
books [title.to_sym] = rating.to_i | |
puts "#{title} has been added to your hash with a rating of #{rating}" | |
else puts "That book is already in your hash" | |
end | |
puts books |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment