Jump to content

Repeat a string: Difference between revisions

No edit summary
Line 237:
lists:flatten(lists:duplicate(N,X)).</lang>
This will duplicate a string or character N times to produce a new string.
 
=={{header|Euphoria}}==
<lang Euphoria>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') -- *****</lang>
 
=={{header|F_Sharp|F#}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.