Repeat a string: Difference between revisions

Content added Content deleted
No edit summary
(Added Sinclair ZX81 BASIC)
Line 1,796: Line 1,796:
=={{header|Sidef}}==
=={{header|Sidef}}==
<lang ruby>'ha' * 5; # ==> 'hahahahaha'</lang>
<lang ruby>'ha' * 5; # ==> 'hahahahaha'</lang>

=={{header|Sinclair ZX81 BASIC}}==
Works with 1k of RAM. This program defines a subroutine that expects to find a string and a number of times to repeat it; but all it then does is loop and concatenate, so making it a separate subroutine is arguably overkill.
<lang basic> 10 LET S$="HA"
20 LET N=5
30 GOSUB 60
40 PRINT T$
50 STOP
60 LET T$=""
70 FOR I=1 TO N
80 LET T$=T$+S$
90 NEXT I
100 RETURN</lang>


=={{header|Smalltalk}}==
=={{header|Smalltalk}}==