=begin and =end return 'nil'


#1

So I'm at the part for begin and end, and my code keeps returning back nil, but still allowing me to progress. I just want to make sure I'm writing it correctly despite the bad result.

=begin
I'm code!
=end

And no, there are no spaces after begin and end. It returns nil. What do.


#2

Yes I'm having the same issue to.


#3

Hi Tylerwarbucks and @patrickbetamax,

This post in the old forums explains it pretty well I think:

nil is the Ruby object that represents nothingness. Whenever a method doesn’t return a useful value, it returns nil

You'll be seeing nil after pretty much every time you run your code in this course, so don't worry about it :)


#4

Actually, it does not return nil, as much as there is not a return value so Ruby reports this as nil for 'no return'. Minor semantics, so long as we recognize that the callee doesn't return nil.


#5

actually it doesn't only show nil but it says "Oops, try again. It looks like you didn't include =begin. Make sure there's no space between the equals sign and the word begin!" but doesn't have any error.


#6

@scriptjumper48738

Oops, try again. It looks like you didn't include =begin. Make sure there's no space between the equals sign and the word begin!

That is the error. Please create a new topic if you need help.


#7

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.