func main() { for i:=0;i<10 ;i++ { fmt.Print(100) time.Sleep(1111) } }
能不能每隔一秒打印一次 这个程序运行玩 都全部打出来了
func main() { for i:=0;i<10 ;i++ { fmt.Print(100) time.Sleep(1111) } }
能不能每隔一秒打印一次 这个程序运行玩 都全部打出来了
看看手册吧,time.Sleep(nanosecond)
的单位是奈秒
package main
import (
"fmt"
"time"
)
func main() {
for i := 0; i < 10; i++ {
fmt.Println(100)
time.Sleep(time.Second)
}
}