18 lines
302 B
Go
18 lines
302 B
Go
package iteration
|
|
|
|
import "strings"
|
|
|
|
const defaultRepeatCount = 5
|
|
|
|
func RepeatFive(character string) string {
|
|
return Repeat(character, defaultRepeatCount)
|
|
}
|
|
|
|
func Repeat(character string, count int) string {
|
|
if count == 0 {
|
|
count = defaultRepeatCount
|
|
}
|
|
|
|
return strings.Repeat(character, count)
|
|
}
|