time.sleep golang 10 seconds code example
Example: sleep n seconds in go
/*
this is golang code but the
java syntax highlighting was
good, so yeah
*/
package main
import (
"fmt"
"time"
)
func main() {
for i := 1; i <= 5; i++ {
fmt.Println(i)
time.Sleep(1 * time.Second) // for 1 second
time.Sleep(1 * time.Millisecond) // for 1 millisecond
}
}