Anonymous user
Repeat a string: Difference between revisions
Add vlang V
(add BQN) |
(Add vlang V) |
||
Line 2,697:
produces
<pre>HOHOHO</pre>
=={{header|Vlang}}==
<lang go>// Repeat a string, in V
// Tectonics: v run repeat-a-string.v
module main
import strings
// starts here
pub fn main() {
// A strings module function to repeat strings
println(strings.repeat_string("ha", 5))
// Another strings module function to repeat a byte
// This indexes the string to get the first byte of the rune array
println(strings.repeat("*"[0], 5))
}</lang>
{{out}}
<pre>prompt$ v run rosetta/repeat-a-string.v
hahahahaha
*****</pre>
=={{header|Wart}}==
|