Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想销毁 ruby 中的变量,就好像它从未存在过一样。这是一个例子:
> defined? a => "nil" > a = 1 > defined? a => "local-variable"
现在我需要将变量 a 设置为“nil” defined?。
defined?
我尝试了一些类似的东西:
> a = nil #Not working => nil > defined? a => "local-variable"
但似乎没有任何效果。
截至目前(MRI 2.2 及之前),没有办法做到这一点。