Doubt about "A night at the movies"


Hi i´m new on programming and i want to learn/know if this code:

movies = {
StarWars: 4.8,
Divergent: 4.7

puts "What would you like to do? "

choice = gets.chomp

case choice
when “add”
puts "What movie would you like to add? "
title = gets.chomp.to_sym
puts "What rating does the movie have? "
rating = gets.chomp.to_i

if movies[title].nil?
movies[title]= rating
puts “Got it!”
puts “That movie already exists daugh”

when “update”
puts “What movie are you searching for?”

if movies[title].nil?
puts “Sorry dude, that movie isn’t in the hash”
puts “Ok, please write your rating of that movie”
movies[title]= gets.chomp.to_i

when “display”
movies.each do |movie,rate|
puts “#{movie}: #{rate}”
when “delete”
puts “Deleted!”
puts “Error!”
#end of the code

can be converted to continue doing actions(same, other) despite of doing 1 action and then have to start over the program.
Thank you very much!
pd: my english is far to be well but i try to be the more clear as possible

link of excercise =


Consider writing the whole thing inside a loop, but be sure to give yourself a way to stop the loop (add a quit option).


Oh that´s a really good idea, thank you!! i think i will need to use the loop do and break syntax. I´m not sure but i will try that way .


Man thank you very much i tried with loop do and break if and it worked well ! :DDDD


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.