Bug In Ruby


All of my code prints Nil at the end of it after it runs. This is a bug that can be fixed very easily. Can someone at Codecademy please take the time to fix this?

Thank you


pode me manda o que esta errado


Me manda que eu posso te ajuda a melhora claro


It is not a bug, just normal terminal behavior. Ignore.


LOL - You sound like the developers at my company - "it's not a bug, just ignore it" - LOL.

Just my opinion, but as a developer, if there is something showing up on the screen that I don't want showing up on the screen, and I have no way of turning it off with code, I think it may be a bug. With all do respect, I don't think it should be something we have to "ignore". Why doesn't someone just fix it :o) ? Or if you don't like the word "fix" because you don't think it's broken, why doesn't someone just make it stop happening so we don't have to ignore it anymore?

This post is just a suggestion, but it is really very annoying. Especially when the last output line of my code looks like this:
The answer you typed is TRUE!!!!nil



Hi - I just reread my poste above and realized it sounds kind of snarky. No snarky-ness intended. Just trying to help make things better :o).


We must consider that we are in a console environment, not a browser or device window. There is no changing the natural behavior of Ruby in the console. It does what it does. Nothing to fix. I don't find your post snarky. I tend to speak that way sometimes, too.


Got it. I guess I can live with it then. I can at least add a puts at the end of my code to get it down on the next line :o). Thanks for the response mtf.


That's not Ruby's doing though, not the printing part anyway. Seems like Codecademy wanted it to be possible to print out the result of expressions, like this:


So that it'd show up as 5 in the console in place of that nil

But when your code isn't just one expression, it prints nil or equivalent in other languages

I consider it a poorly thought through feature. Or at least they could hide that value if it's nil/None/undefined etc

If I run a ruby script from the terminal, it'll look like:

$ echo "puts 'hello world'" > hello.rb
$ ruby hello.rb 
hello world

(It runs and then I'm back at the prompt. No nil.)


Thanks Jonatan - Ok - who wants to get up a petition to get the nil removed!? :o)


I usually get ignored and give up.


I still say just ignore it.