FAQ: Control Flow in Ruby - How It Works

Dumb question… Are you entering a number at the prompt in the console after you click Run?

gets   =>  get string
chomp  =>  remove trailing newline
1 Like

Same question as the guys above… where do we input the integer that we’re prompted to supply once we hit run???

1 Like

Hi, same issues as the others (also had in other exercices). I enter the answer in the console but the running button seems no to work and then I receive an anwer “execution has exprired”

1 Like

Got it…you have to click on the flashing white box on the far right console. You cant just hit the black space. Weird quirk i guess

4 Likes

In this exercise, as in the earlier exercise on Formatting, I am unable to enter requested input in the terminal (right side). It accepts no input and after about 10 seconds I receive the message execution expired. What am I doing wrong? I’m using an iMac with the latest OS and have tried the exercise using both the Safari and Chrome browsers. Same result in each case.

1 Like

Have you tried what @bsanto bsanto said? That is clicking where you see the blinking cursor appear, in the right console, after clicking run?

Yes, xxmr.anonxx, that’s the first thing that I tried. The terminal column (on the right hand side) accepts no keystrokes.
Mateen

Can you provide a copy of your code? And have you tried clearing your cache?

I’ll try clearing the cache though I hate to use all the useful cache I have on my computer. Is there a way to clear the cache just for Ruby part. I don’t think that cache is the problem as I tried the exercise on a different browser where I had never accessed Code Academy and it didn’t work there either. However, you made me think that perhaps there is something in my security settings or preferences that prevents me from entering keystrokes in the terminal. I have to go out now. Will try later.

The code is okay, as it’s Code Academy’s code (after clicking on help and asking Code Academy for the solution) in their introduction to Ruby course. I get the blinking cursor as expected in the terminal, but when I click on the cursor and try to input anything at all, there is no response. This is true for every exercise (i.e. every code of the Code Academy) where the code asks for input from the user. The only way that I can advance to the next lesson is to ask Code Academy for the solution and then click on Next.

1 Like

Clearing cache and cookies for a specific website is very easy to do on chrome and is easily explained here. As far as security settings go I am unaware of any that would prevent you from typing in the output terminal but not in the input terminal. I would check your extensions to make sure that there are no extensions interfering with the site.

xxmr:

Thanks for continuing to try to help me. I checked the extensions and found that the only third party extension I had was Dropbox. All the other extensions were standard Apple ones. I unchecked the Dropbox extension. I also checked my Privacy settings in Security and Privacy and clicked on “allow full disk access” to Safari and unchecked Limit Ad Tracking under Advertising. Finally under Privacy, I also checked Safari for Input Monitoring (Allow the apps to monitor input from your keyboard even while using other apps). In each case I restarted Safari. No difference.

I haven’t yet cleared the cache (though I did learn how to do this for each website in both Safari and Chrome, which are the two browsers I use) but I’m pretty sure that that’s not the problem because it exists even when I moved to Chrome when there was no cache for Code Academy. (I’m a bit hesitant about clearing cache in case it also erases the fact that I completed 36% of the course).

Any other thoughts? Anyone?

I would be surprised if clearing your cache erased how far you’ve made it in the course because that data isn’t stored locally. I am unable to replicate what is happening to you and would recommend that you submit a ticket and see if they can resolve the issue. Sorry I couldn’t help!

To re-iterate, not all workarounds work, and rather than analyze the hardware and software environments we can make it out of this lesson without the Solution button simply by defining the variables and bypassing the user inputs. Focus on what the code is doing and less on the handicaps of the interface.

These are not new concerns and if the ultimate workaround were to surface it would either end up in the FAQ as a NB, or would have been implemented by engineers. As cross-site as these behaviors are, the impact of the actual lesson is being lost in a good lot of the free content. Accept that this will be the norm and make the most of what lessons can be learned per subject, all other matters aside.

1 Like

I cleared the cache and cookies. Terminal still doesn’t recognize any keystrokes in the flashing white rectangle.

In addition to posting in this forum I reported the apparent bug a few days ago. No response from Code Academy yet.

Mateen

Dear xxmr and others who may have followed this link,

I solved my problem of being unable to type in text in the terminal or console when prompted. It wasn’t enough just to move my cursor over to the blinking light and start typing, I needed to first CLICK my mouse on the blinking cursor and THEN type. Stupid me!

Sorry for taking up your time but I hope that this may help someone else who has this problem.

I have another unrelated problem. The console ALWAY prints out a — instead of the number 9 when the code call for printing out an array that has the number 9 in it. Any thoughts about why that could be and how to fix it?

Best wishes,

Mateen

2 Likes

Hi Mateen, I’m glad to hear the previous issue has been resolved.

Can you provide the code you are using for the new issue?

A post was split to a new topic: Weird printing of 9 as a — only occurs in Firefox

Hi! I’m able to run the program, input my integer and receive the response but then it acts like the program is loading forever and I can’t move on to the next step. Any suggestions? I’m using Firefox.

1 Like

This is a recurring issue through many of the topics on CA. Perhaps they need to include special instructions for the console?

One expects these old course modules will be retired in the not too distant future. The problems seem to have cropped up when CC changed the learning environment to a Node.js based platform. It affected Ruby, Python and JS in roughly the same way… Not handling user inputs.

In Node.js, JS’s, prompt() is not directly supported and requires a special module, prompt-sync which the engineers may have left out on purpose, or by simply overlooking the need for this added support.

We should not expect this to get fixed any time soon, if at all.

These are my comments, and not the advice from CC.

1 Like