Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- "time"
- )
- func doNothing() {
- for {
- }
- }
- func doSomething() {
- for i := 0; i < 10; i++ {
- time.Sleep(time.Millisecond * 5)
- fmt.Printf("%d ms\n", i)
- }
- }
- func main() {
- for i := 0; i < 10; i++ {
- go doNothing()
- }
- doSomething()
- // What's the output of this code in the 5s duration?
- // What's the output when line 15 is commented out?
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement