Skip to content

Instantly share code, notes, and snippets.

@jumanji27
Created April 11, 2025 13:42
Show Gist options
  • Save jumanji27/f90b266266ec717773bf504a6effbaa0 to your computer and use it in GitHub Desktop.
Save jumanji27/f90b266266ec717773bf504a6effbaa0 to your computer and use it in GitHub Desktop.
go-problems-3.go
package main
import (
"fmt"
)
var counter int
func increment() {
for i := 0; i < 1000; i++ {
counter++
}
}
func main() {
for i := 0; i < 5; i++ {
go increment()
}
fmt.Println("Counter:", counter)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment