FAQ: Putting the Form in Formatter - Getting Input

This community-built FAQ covers the “Getting Input” exercise from the lesson “Putting the Form in Formatter”.

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

Learn Ruby

FAQs on the exercise Getting Input

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!

I wrote in the terminal my first name but it seems it doesn’t work, it says: uninitialized constant Context::Tiago

Can someone help me?

When I write the code into the editor and run it, the terminal will not allow me to enter my name. After 30sec or so (I haven’t timed it) it tells me “Execution expired”. Any ideas as to what the problem is?

1 Like

Did you find what the problem was? I have experienced the same issue.

1 Like

Hello All, I’ve been experiencing exactly the same issue: cannot type anything at all in the terminal, no matter how well and clean I’ve written that simple code.

Can someone help please? :slightly_smiling_face:

I’m also getting the “execution expired” msg for two days now…

The interface is suspect, and gets is probably not recommended. The workaround is to define your input values as literals then see the code operation through its paces.

I have the same problem…

Are you clicking on the output console? Try clicking where the blinking cursor appears after clicking “Run”.

3 Likes

a workaround is to define the variable with string and place the gets.chomp in comment

I had the same problem and this was my issue. Thanks for the help.

Same problem for me using chrome 87.0.4280 on mac os 11.1

1 Like

I had the same issue, so I printed the string to the screen first and all went well.

puts first_name = "What is your first name? "
print first_name = gets.chomp

What did the screen display?

What is your first name?
Angela (I entered this.)
Angela

As expected. Suggest not printing on that line, however.

first_name = gets.chomp
puts first_name

The timeout is very quick, so as long as we click the cursor, type a name and enter within a matter of seconds, the input should be accepted and accessed by variable name.

I dont understand whats the point of adding .chomp . The result seems to be the same if I use gets and gets.chomp

.chomp truncates the string to remove the newline character that is attached by gets.

2 Likes

I was having the same problem as other above, but it’s the interface, not the code that’s the problem.

I typed the code exactly as it says in the instructions and typed my name in the terminal and nothing happened. I ran it several times and still nothing happened. I left it idle for a few minutes, ran it again and it worked.

I must say that the instructions for the exercises are not very clear at all for a beginner. It’s taken me two hours to get this far because the instructions are so ambiguous.

1 Like