Jump to content

Repeat a string: Difference between revisions

no edit summary
No edit summary
Line 1,272:
}
}</lang>
 
=={{header|NetLogo}}==
<lang NetLogo>
to go
output-print ( _repeat_string_ "ha" 5) ;; output "hahahahaha"
end
 
to-report _repeat_string_ [ _string _times ]
let _repeat_string "" ;; initialize
let _counter 0 ;; initialize
while [ _counter < _times ]
[
set _repeat_string ( word _repeat_string _string )
set _counter ( _counter + 1 )
]
report _repeat_string
end
</lang>
 
=={{header|NetRexx}}==
Line 2,179 ⟶ 2,197:
Same as Ruby
<lang zkl>"ha" * 5 # --> "hahahahaha"</lang>
 
 
 
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.