Repeat a string: Difference between revisions

Content added Content deleted
Line 807: Line 807:


=={{header|Lua}}==
=={{header|Lua}}==
<lang lua>function repeats(s, n) return n > 0 and s .. repeat(s, n-1) or "" end</lang>
<lang lua>function repeats(s, n) return n > 0 and s .. repeats(s, n-1) or "" end</lang>


Or use native string library function
Or use native string library function