源代码:
#!/usr/bin/ruby # -*- coding: UTF-8 -*- def test(a1="Ruby", a2="Perl") puts "编程语言为 #{a1}" puts "编程语言为 #{a2}" end test "C", "C++" test
运行结果:
#!/usr/bin/ruby # -*- coding: UTF-8 -*- def test(a1="Ruby", a2="Perl") puts "编程语言为 #{a1}" puts "编程语言为 #{a2}" end test "C", "C++" test