This repository has been archived on 2023-04-29. You can view files and clone it, but cannot push or open issues or pull requests.
golang-concurrency/main.go

21 lines
218 B
Go

package main
import (
"fmt"
"time"
)
func f(from string) {
for i := 0; i < 3; i++ {
fmt.Println(from, ":", i)
}
}
func main() {
f("direct")
go f("goroutine")
time.Sleep(time.Second)
fmt.Println("done")
}