Skip to content

Instantly share code, notes, and snippets.

@dansku
Created March 12, 2019 20:18
Show Gist options
  • Select an option

  • Save dansku/a5e132468f3a0dd07826bfd6ed1ffebe to your computer and use it in GitHub Desktop.

Select an option

Save dansku/a5e132468f3a0dd07826bfd6ed1ffebe to your computer and use it in GitHub Desktop.
// Package raindrops provides all the tools for the raindrops exercism task.
package raindrops
import "strconv"
// Convert gets an integer number and returns the right string output as requested in the task.
func Convert(number int) string {
var raindrop string
if number%3 == 0 {
raindrop += "Pling"
}
if number%5 == 0 {
raindrop += "Plang"
}
if number%7 == 0 {
raindrop += "Plong"
}
if raindrop == "" {
return strconv.Itoa(number)
}
return raindrop
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment