<body>

Caiwangqin's blog

Focus on Web2.0, Business, Architecture, Agile, Technic and beyond…

Ruby 代码 - 使用星号展开数组

2006年10月13日 星期五

问题来自Ruby On Rails 中文社区论坛数组前加个星号表示什么,示例:


def test(a,b,c,d,e)
    print “#{a}, #{b}, #{c}, #{d}, #{e}”
end


array = [1,2,3,4,5]


test(*array)



标签:

posted by Caiwangqin, 上午1:56

<< 主页