Why. Why. WHY? Just work please! 4. Prompting: Redux


#1



Why won't this work?!?! I have been working at this for an hour now and nothing will work! I even copy and pasted SEVERAL times! frustrating. :persevere:

https://www.codecademy.com/courses/ruby-beginner-en-0i8v1/0/4?curriculum_id=5059f8619189a5000201fbcb#

(ruby):16: syntax error, unexpected keyword_when, expecting keyword_end
when "update"
^
(ruby):18: syntax error, unexpected keyword_when, expecting keyword_end
when "display"
^
(ruby):20: syntax error, unexpected keyword_when, expecting keyword_end
when "delete"
^
(ruby):25: syntax error, unexpected $end, expecting keyword_end


Replace this line with your code. 
movies = {
    Narnia: 5,
}

    puts "What is it that you want to do?"
choice = gets.chomp

case choice
when "add"
   print "What movie do you want to add?"
  title = gets.chomp
  if movies[title.to_sym].nil?
    print "What's the rating? (Type a number 0-4.)"
    rating = gets.chomp
    movies[title.to_sym] = rating.to_i
    puts "#{title} has been added with a rating of #{rating}."
when "update"
    puts "Updated!"
when "display"
    puts  "Movies!"
when "delete"
    puts "Deleted"
else
    puts "Error!"
end


#2

if gets an end after its block.


#3

Oh... Thanks... :sweat_smile:


#4

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