Last active
September 23, 2016 19:20
-
-
Save sylar/79bfb977b119f05c187e53f20b7808ee 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
movies={ | |
"The Prestige" => 5, | |
"Titanic" => 3 | |
} | |
exists = false | |
puts 'Write "add" to insert a movies' | |
choice=gets.chomp | |
case choice | |
when "add" | |
puts "Give me a title!" | |
title=gets.chomp | |
puts "Rate the movie" | |
rating=gets.chomp | |
movies.each do | movieTitle, movieRating | | |
if movieTitle == title | |
exists = true | |
end | |
end | |
if !exists | |
movies[title] = rating | |
puts "Rating and name were added" | |
else | |
puts "The movie already exists!" | |
end | |
puts movies | |
when "update" | |
puts "Updated!" | |
when "display" | |
puts "Movies!" | |
when "delete" | |
puts "Deleted!" | |
else | |
puts "Error!" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment