Skip to content

Instantly share code, notes, and snippets.

@genghisjahn
Created September 24, 2013 01:20
Show Gist options
  • Save genghisjahn/6679194 to your computer and use it in GitHub Desktop.
Save genghisjahn/6679194 to your computer and use it in GitHub Desktop.
Source code for blog post on FizzBuzz Go.
package fizzbuzz
import(
"strconv"
)
type FizzBuzzProcessor struct{
Items
}
type IFizzBuzzItem interface{
GetResult(num int) string
}
type Items []IFizzBuzzItem
func(fbp *FizzBuzzProcessor) GetResult(num int) string{
result:=""
numstr:=strconv.Itoa(num)
for i := 0; i < len(fbp.Items); i++ {
fbd:=fbp.Items[i]
result=fbd.GetResult(num)
if(numstr!=result){break}
}
return result
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment