Jump to content

Repeat a string: Difference between revisions

m
→‎{{header|Go}}: small clarification
m (→‎{{header|Go}}: small clarification)
Line 396:
 
=={{header|Go}}==
<lang go>fmt.Println(strings.Repeat("ha", 5)) # // ==> "hahahahaha"</lang>
There is no special way to repeat a single character, other than to convert the character to a string. The following works:
"Characters" are just strings of length one.
<lang go>fmt.Println(strings.Repeat(string('h'), 5)) // prints hhhhh</lang>
 
=={{header|Groovy}}==
1,707

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.