From: "François Montel" Date: 2007-04-05T04:25:23+09:00 Subject: nil? and non-existent objects Why is it that the nil? method can sometimes be called on an object that doesn't exist, and other times will return an error. Under what circumstances can you call the nil? method on a non-existent object? Consider: >> puts x = 1 if x.nil? => 1 >> puts ‘z is not defined’ if z.nil? => NameError: undefined local variable or method ‘z’ Someone mentioned that = has higher precedence than if, so it could be that in the first statement x is assigned 1 before the conditional statement is run. However, x.nil? would then always return false. -- Posted via http://www.ruby-forum.com/.