RosettaCodeData/Task/Repeat-a-string/Euphoria/repeat-a-string-1.euphoria

17 lines
350 B
Plaintext

function repeat_string(object x, integer times)
sequence out
if atom(x) then
return repeat(x,times)
else
out = ""
for n = 1 to times do
out &= x
end for
return out
end if
end function
puts(1,repeat_string("ha",5) & '\n') -- hahahahaha
puts(1,repeat_string('*',5) & '\n') -- *****