源代码:
点击运行
#!/usr/bin/ruby # -*- coding: UTF-8 -*- def sample (*test) puts "参数个数为 #{test.length}" for i in 0...test.length puts "参数值为 #{test[i]}" end end sample "Zara", "6", "F" sample "Mac", "36", "M", "MCA"
运行结果