Skip to content

Instantly share code, notes, and snippets.

@klrkdekira
Created August 20, 2016 14:05
Show Gist options
  • Save klrkdekira/0e49f80c8c92eaead339044375c23c26 to your computer and use it in GitHub Desktop.
Save klrkdekira/0e49f80c8c92eaead339044375c23c26 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"time"
)
func main() {
for i := 1; i <= 100; i++ {
go fizzbuzz(i)
}
// no synchronization, just wait
time.Sleep(3 * time.Second)
}
func fizzbuzz(i int) {
msg := fmt.Sprintf("%d - ", i)
if i%3 == 0 {
msg += "fizz"
}
if i%5 == 0 {
msg += "buzz"
}
fmt.Println(msg)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment