dimanche 9 octobre 2016

Error message keeps popping up but can't understand whats wrong

I'm learning to code on codecademy and I'm on section "A night at the movies"; 8. Display:

my code is: movies={ Lala:3, VV:4 } puts "What to do?" choice=gets.

case choice when "add" puts "What movie you wanna add?" title=gets.chomp if movies[title.to_sym].nil? puts "What rating for the movie?" rating=gets.chomp movies[title.to_sym]=rating.to_i puts "Movie and rating added!" else puts "movie already in list..." end

when "update" puts "what movie to update?" title=gets.chomp if movies[title.to_sym].nil? puts "Error movie not in list" else puts "New rating?" rating=gets.chomp movies[title.to_sym]=rating.to_i puts "Rating updated" end when "display" movies.each do |movies,rating| puts "#{movies}: #{rating}" end when "delete" puts "deleted!" end

I keep getting this error message: Oops, try again. Your syntax doesn't look quite right. Feel free to peek back at the first exercise if you need help!

(ruby): syntax error, unexpected tIDENTIFIER, expecting $end ...s={ Lala:3, VV:4 } puts "What to do?" choice=gets. ... ... ^

HELP!!!

Aucun commentaire:

Enregistrer un commentaire