[ create a new paste ] login | about

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

Ruby, pasted on Jul 26:
1
2
3
4
5
6
7
8
def repeat(a, b=2)
	result = a
	b -= 1
	b.times{result <<  ' ' + a; puts a}
	puts result
end

repeat('hi', 5)


Output:
1
2
3
4
5
hi hi
hi hi hi hi
hi hi hi hi hi hi hi hi
hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi
hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi


Create a new paste based on this one


Comments: