The code below returns true if @var is non-nil.
class MyClass
def a_simple_method
not @var.nil?
end
end
When I use the keyword return like this:
class MyClass
def a_simple_method
return not @var.nil?
end
end
it returns a syntax error:
syntax error, unexpected tIVAR, expecting '('
return not @var.nil?
^
What did I understand wrong about return?
It tells you to use
()