From: Navindra Umanee Date: 2012-01-28T08:40:00+09:00 Subject: Why is a = a nil instead of giving NameError Could someone help me understand what is happening here? irb(main):001:0> a NameError: undefined local variable or method `a' for main:Object from (irb):1 irb(main):002:0> b NameError: undefined local variable or method `b' for main:Object from (irb):2 irb(main):003:0> c NameError: undefined local variable or method `c' for main:Object from (irb):3 irb(main):004:0> b = c NameError: undefined local variable or method `c' for main:Object from (irb):4 from :0 irb(main):005:0> a = a => nil a is undefined, so why does "a = a" work instead of giving a NameError like "b = c" does? Also: irb(main):006:0> b = c NameError: undefined local variable or method `c' for main:Object from (irb):6 from :0 irb(main):007:0> b => nil Why did b get initialized to nil if there was a NameError? Source: https://www.destroyallsoftware.com/talks/wat Thanks! Navin. -- Posted via http://www.ruby-forum.com/.