Last active
August 29, 2015 14:00
-
-
Save goFrendiAsgard/24be9be6e0be8be7658e to your computer and use it in GitHub Desktop.
Try concurrency
This file contains 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" | |
"time" | |
) | |
func write(n int){ | |
for i := 0; i<100; i++ { | |
time.Sleep(100 * time.Millisecond) | |
if i%n == 0{ | |
fmt.Println(i, " bisa dibagi " ,n) | |
} | |
} | |
} | |
func main() { | |
go write(2) | |
go write(3) | |
go write(5) | |
write(7) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment