exercism/go/raindrops/raindrops.go
2016-08-13 18:20:14 -05:00

27 lines
416 B
Go

package raindrops
import "fmt"
// TestVersion
const TestVersion = 1
// Convert takes a number and returns Raindrop-speak
func Convert(i int) string {
var ret string
if i%3 == 0 {
ret += "Pling"
}
if i%5 == 0 {
ret += "Plang"
}
if i%7 == 0 {
ret += "Plong"
}
if ret != "" {
return ret
}
return fmt.Sprintf("%d", i)
}
// The test program has a benchmark too. How fast does your Convert convert?