ruby 变量问题
def as(flow)
flow.shift
flow
end
flow=["1","2","3","4"]
p as(flow)
p flow
怎么样才能让flow的输出值还是["1","2","3","4"]啊?
就是怎么才能让flow成为全局变量。
[解决办法]
什么意思阿?flow.shift就是将数组的第一号元素去掉,所以你这肯定就是["2","3","4"]
要想按照原来的输出你得用个循环了
[解决办法]
def as(flow) tmp = flow.dup tmp.shift flowend