27 lines
416 B
Go
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?
|