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.

22 lines
247 B

  1. package main
  2. import (
  3. "fmt"
  4. "math/rand"
  5. )
  6. func main() {
  7. for {
  8. r := rand.Intn(8)
  9. if r%3 == 0 {
  10. fmt.Println("Skip")
  11. continue
  12. } else if r%2 == 0 {
  13. fmt.Println("Stop")
  14. break
  15. }
  16. fmt.Println(r)
  17. }
  18. }