Skip to content

为什么要学go?

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")
}

就这一个理由足矣。


Last update: 2024-10-17 11:20:00
Created: 2024-05-29 00:20:03

Comments