Undefine variable in Ruby

后端 未结 5 1266
迷失自我
迷失自我 2020-12-05 06:29

Let\'s say I\'m using irb, and type a = 5. How do I remove the definition of a so that typing a returns a NameError

5条回答
  •  余生分开走
    2020-12-05 06:52

    There are remove_class_variable, remove_instance_variable and remove_const methods but there is currently no equivalent for local variables.

提交回复
热议问题