问题:
I am working through a book which gives examples of Ranges being converted to equivalent arrays using their "to_a" methods我正在阅读一本书,其中给出了使用“to_a”方法将范围转换为等效数组的示例
When i run the code in irb I get the following warning当我在 irb 中运行代码时,我收到以下警告
warning: default `to_a' will be obsolete
What is the the correct alternative to using to_a?使用 to_a 的正确替代方法是什么?
are there alternate ways to populate an array with a Range?有没有其他方法可以用 Range 填充数组?
解决方案:
参考一: https://en.stackoom.com/question/nlx参考二: https://stackoom.com/question/nlx