Why printing # or nil?


#1

My code has been accepted at the end of each exercise, but after I Save&Submit Code, it either prints 'nil' or '#' in the console. Why is this happening? My final code/screen is below:

Thanks!


#2

Hey

The reason you usually get either 'nil' or '#' in the console, is because these are the return values for puts and Class.new, and the editor will output the last value returned to it.
Try adding a "puts" command to the bottom of your code and it will end with 'nil', while putting a simple number will display that number as last.

Regarding the Class.new return value, you can see the result a normal ruby compiler would return by running "puts my_computer.inspect" in the Codecademy editor, since I guess here they filter out the rest.
For instance, with the code you have above, the return value in IRB (Interactive Ruby Shell), is
#<Computer:0x3322158 @username="YT", @password=17485, @files={}>