MDGSF Software Engineer

[GO] goroutines

2017-09-19
GO

package main

import (
    "fmt"
    "time"
)

func say(s string) {
    for i := 0; i < 5; i++ {
        time.Sleep(100 * time.Millisecond)
        fmt.Println(s)
    }
}

func main() {
    go say("world")
    say("hello")
}

weixingongzhonghao

上一篇 [GO] errors

下一篇 [GO] Interface

Comments

Content