[ create a new paste ] login | about

Link: http://codepad.org/Iv7ciMgK    [ raw code | output | fork ]

Ruby, pasted on Nov 25:
1
2
3
4
5
6
7
8
9
10
11
def method_with_varargs(a, b = true, *c)
  puts
  puts a.inspect
  puts b.inspect
  puts c.inspect
end

method_with_varargs(1)
method_with_varargs(1, 2)
method_with_varargs(1, 2, 3)
method_with_varargs(1, 2, 3, 4)


Output:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

1
true
[]

1
2
[]

1
2
[3]

1
2
[3, 4]


Create a new paste based on this one


Comments: