Inexistent instance variable value

R

Ricardo Amorim

Howdy,

I have noticed this a while ago and someone asked in IRC, and I have
no clue on WHY this happens:

irb(main):001:0> local_var
NameError: undefined local variable or method `local_var' for main:Object
from (irb):1
irb(main):002:0> @local_var
=> nil

Why are instance_variables always available as nil when not defined?

Regards,

Ricardo Amorim
mapaBRASIL.net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top