Undefine variable in Ruby

后端 未结 5 1268
迷失自我
迷失自我 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 07:03

    Currently you have no mean to remove global variables, local variables and class variables. You can remove constants using "remove_const" method though

提交回复
热议问题