Standard library / time
time.Sleep()
Pause the current goroutine for at least d; nonpositive durations return immediately. It is not synchronization with another goroutine. Expected stdout: 'resumed\n'.
Formal Syntax & Structure
go syntaxgo
func Sleep(d Duration)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| d | Duration | Elapsed duration or interval. |
Working Example
Example Snippetgo
package main
import ( "fmt" "time")
func main() { time.Sleep(0); fmt.Println("resumed") }