阅读背景:

在Ruby中使用变量的值作为另一个变量名

来源:互联网 

I'm just starting out in learning Ruby and I've written a program that generates some numbers and assigns them to variables @one, @two, @three etc. The user can then specify a variable to change by inputting it's name (e.g one). I then need to do something like '@[valueofinout] = asd'. How would I do this, and is there a better way as the way I'm thinking of seems to be discouraged? I've foundI'm just starting out in learning Ruby and I've




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: