ruby equivalent of isset()

Rick Olson wrote in post #29743:

The default value is nil, and thus false.

if myvar
  #some code
else
  #default behaviour
end

Works.

That works with @instance vars, but not local vars. You'll get a
NameError. You can do this, however:

if defined?(my_var)
  #
else
  #
end

--
Rick Olson
http://techno-weenie.net

     Effective Answer

     Mukto