Created
March 12, 2019 20:18
-
-
Save dansku/a5e132468f3a0dd07826bfd6ed1ffebe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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