Created
April 11, 2025 13:42
-
-
Save jumanji27/f90b266266ec717773bf504a6effbaa0 to your computer and use it in GitHub Desktop.
go-problems-3.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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