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!”
else
puts “Error!”
end

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

choice = gets.chomp
choice.downcase

works as well

Be sure to test with a fresh page.

choice.downcase

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

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?

thanks

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.