Created
September 26, 2013 01:29
-
-
Save genghisjahn/6708640 to your computer and use it in GitHub Desktop.
FizzBuzzDivisor for BlogPost
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 fizzbuzz | |
import( | |
"strconv" | |
) | |
type FizzBuzzDivisor struct{ | |
Value int //Value to be tested. | |
Message string //Message if a condition is met. | |
} | |
func (fbd FizzBuzzDivisor) GetResult(num int) string { | |
result:=strconv.Itoa(num) | |
if num % fbd.Value==0{ | |
result = fbd.Message | |
} | |
return result | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment