M
Mage
Hello,
(1..2).each { if 1 == 2 then a = 5 else puts a end }
nil
nil
(1..2).each { if 1 == 2 then b = 5 else puts a end }
NameError: undefined local variable or method `a' for main:Object
from (irb):8
from (irb):8
Okay, I understand what happend, but I am wondering. Is this okay? Is
there any philosophical reason behind it or it's just easier for the
interpreter?
Mage
(1..2).each { if 1 == 2 then a = 5 else puts a end }
nil
nil
(1..2).each { if 1 == 2 then b = 5 else puts a end }
NameError: undefined local variable or method `a' for main:Object
from (irb):8
from (irb):8
Okay, I understand what happend, but I am wondering. Is this okay? Is
there any philosophical reason behind it or it's just easier for the
interpreter?
Mage