FAQ: A Night at the Movies - The Case Statement

This community-built FAQ covers the “The Case Statement” exercise from the lesson “A Night at the Movies”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Learn Ruby

FAQs on the exercise The Case Statement

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

When I enter “Add”, I get “Added!”, but when I enter “add”, it returns error? What gives? You’d think you can’t downcase lower case strings any further???

choice = gets.chomp.downcase!

case choice
when “add”
puts “Added!”
when “delete”
puts “Deleted!”
when “update”
puts “Updated!”
when “display”
puts “Movies!”
puts “Error!”

I know this is old but I noticed when I did choice = gets.chomp.downcase
it works also

choice = gets.chomp

works as well

Be sure to test with a fresh page.


by itself, like that does nothing.

We need the bang method (!) to have the operation take place in situ. The above expression needs to be assigned.

choice = choice.downcase
1 Like

still throwing an error when I type ‘add’ into the input, but ‘ADD’, ‘Add’ etc… works just fine… can you explain whats going on? thanks

Hi! hello, I’m having some issues making some exercises, specially with this one about case statements… and it doesn’t allow me to keep going with my lessons…
Can anyone help me to fix this?


1 Like

I have the same issue. After inputting a value in the console, after so many seconds, it times out with the “execution expired” message.

I also had this problem in Chrome. Run, input a value, then “execution expired” after what seemed like a time out. But is working in Firefox

Strange. I only use Firefox, and that is where I experienced the issue.

Ah, interesting! Have you tried switching to a different browser? Perhaps clearing cache?
I was just posting because the first fix I tried (different browser) worked, in the hope it might help others, I’m not suggesting Firefox is the silver bullet!

Because it is JavaScript that is running server-side (i.e. checking your code), then I would expect this to be browser agnostic. I cleared the cache but it didn’t seem to resolve the problem. In the end, I passed the lesson by being able to select the ‘Next’ button, even when the ‘execution expired’ message appeared.

Could anyone help troubleshoot where i’ve gone wrong with the below code please?

As required in the question, i setup the case conditions, and after running, it gives me the result required. Unfortunately they still tell me I’m not receiving the correct outcome: It looks like your case statement doesn’t puts ‘Added!’ when choice == ‘add’.

ah ok i realize im replying to my own comment but just in case anyone gets the same issue, i don’t think theres anything wrong with my code, just that the program is a little nitpicky.

movies = {
  StarWars: 4.8, 
  Divergent: 4.7

puts "What would you like to do? "

choice = gets.chomp

case choice
when "add"
  puts "Added!"
when "update"
  puts "Updated!"
when "display"
  puts "Movies!"
when "delete"
  puts "Deleted!"
  puts "Error!"

Its exactly the same except for the first few sentances.

1 Like