Repeat a string: Difference between revisions
Content added Content deleted
(Undo revision 83780 by 80.130.181.48 (Talk) it's meant as an expression,to incorporate into larger statement;by itself it is useless) |
(Adding MUMPS example) |
||
Line 346: | Line 346: | ||
=={{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 .. repeat(s, n-1) or "" end</lang> |
||
=={{header|MUMPS}}== |
|||
<lang MUMPS> |
|||
RPTSTR(S,N) |
|||
;Repeat a string S for N times |
|||
NEW I |
|||
FOR I=1:1:N WRITE S |
|||
KILL I |
|||
QUIT |
|||
RPTSTR1(S,N) ;Functionally equivalent, but denser to read |
|||
F I=1:1:N W S |
|||
Q |
|||
</lang> |
|||
=={{header|OCaml}}== |
=={{header|OCaml}}== |