Exercises & activities from the go workshop provided by Packt: https://courses.packtpub.com/courses/go
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
372 B

  1. package main
  2. import "fmt"
  3. func fizzBuzz() {
  4. for i := 1; i <= 30; i++ {
  5. if i%15 == 0 {
  6. fmt.Println("FizzBuzz")
  7. } else if i%3 == 0 {
  8. fmt.Println("Fizz")
  9. } else if i%5 == 0 {
  10. fmt.Println("Buzz")
  11. } else {
  12. fmt.Println(i)
  13. }
  14. }
  15. }
  16. func main() {
  17. fmt.Println("Main is in control")
  18. fizzBuzz()
  19. fmt.Println("Back to main")
  20. }