learn-go-with-tests/iteration/repeater.go

11 lines
149 B
Go
Raw Normal View History

2025-02-02 02:18:14 +00:00
package iteration
func Repeat(char string, n int) string {
var repeated string
for i := 0; i < n; i++ {
repeated += char
}
return repeated
}