Tim:~> irb
>> local_variables
=> ["_"]
>> if false
>> some_variable = :yahoo
>> end
=> nil
>> some_variable
=> nil
>> local_variables
=> ["_", "some_variable"]
Isn't that interesting? When I define a variable within an if statement that will never be entered (and thus the variable will never be assigned to :yahoo), it is listed as a local variable and set to nil.
No comments:
Post a Comment