Repeat a string: Difference between revisions

Content added Content deleted
Line 753: Line 753:
for i = 1 to 5 do s &= "ha" end for
for i = 1 to 5 do s &= "ha" end for
puts(1,s)
puts(1,s)

hahahahaha
</lang>
</lang>


Line 758: Line 760:
<lang Euphoria>
<lang Euphoria>
sequence s = repeat('*',5)
sequence s = repeat('*',5)

*****
</lang>

For repeating a string or sequence of numbers:
<lang Euphoria>
include std/console.e -- for display
include std/sequence.e -- for repeat_pattern
sequence s = repeat_pattern("ha",5)
sequence n = repeat_pattern({1,2,3},5)
display(s)
display(n)

hahahahaha
{1,2,3,1,2,3,1,2,3,1,2,3,1,2,3}
</lang>
</lang>