Answers for "sleep n seconds in go"

1

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
    }
}
Posted by: Guest on March-22-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language