Skip to content

Instantly share code, notes, and snippets.

@benthurley82
Created April 11, 2019 10:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benthurley82/a733de593f900ef7d5fda03fc287bd8d to your computer and use it in GitHub Desktop.
Save benthurley82/a733de593f900ef7d5fda03fc287bd8d to your computer and use it in GitHub Desktop.
FizzBuzz test in Go created by benthurley82 - https://repl.it/@benthurley82/FizzBuzz-test-in-Go
module main
go 1.12
package main
import (
"strconv"
"fmt"
)
func main() {
for i := 1; i <= 100; i++ {
line := ""
if i%3 == 0 {
line += "Fizz"
}
if i%5 ==0 {
line += "Buzz"
}
if len(line) == 0 {
line = strconv.Itoa(i)
}
fmt.Println(line)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment