Repeat a string: Difference between revisions

Removed locals, splitted up code in a string repetition and character repetition part.
(Added PicoLisp)
(Removed locals, splitted up code in a string repetition and character repetition part.)
Line 151:
create test 256 allot
s" ha" test 5 place-n
test count type \ hahahahaha</lang>
The same code without the use of locals:
<lang forth> ( src len dest n -- )
: place-n 0 over c! 0 ?do >r 2dup r@ +place r> loop drop 2drop ;
 
create test 256 allot
s" ha" test 5 place-n
test count type cr \ hahahahaha</lang>
Filling a string with a single character is supported by ANS-Forth:
<lang forth>create test 256 allot
 
test 10 char * fill \ repeat a single character
test 10 type</lang>
</lang>
 
=={{header|Fortran}}==
374

edits