【发布时间】:2014-02-19 14:18:08
【问题描述】:
假设一个关于 CONSTANT 变量的简单 ruby 程序:
OUTER_CONST = 99
class Const
def get_const
CONST
end
CONST = OUTER_CONST + 1
end
puts Const.new.get_const
我假设Const.new.get_const 的结果应该是nil,但结果是100!我想知道为什么?
【问题讨论】:
-
为什么要投票给我!请脱颖而出。