How to pause execution for 5 seconds in Go

1 Answer

0 votes
package main

import (
    "fmt"
    "time"
)

func main() {
    fmt.Println("Pausing for 5 seconds...")
    
    time.Sleep(5 * time.Second)
    
    fmt.Println("Resuming execution.")
}


 
/*
run:
 
Pausing for 5 seconds...
Resuming execution.
 
*/

 



answered Apr 30, 2025 by avibootz

Related questions

1 answer 153 views
2 answers 172 views
1 answer 144 views
1 answer 165 views
1 answer 122 views
122 views asked Apr 30, 2025 by avibootz
1 answer 143 views
2 answers 146 views
...