[Golang] Sleep Process In Golang
The process of sleeping or waiting on a system can be used to pause a process. so the order underneath will not be executed until the stop is complete. the time variable used can also use a single variable or an array of variables.
in the single variable, the time for stopping or waiting time is only written 1 time or 1 time.
In the Golang programming language the process uses the time.sleep function. In this function, we only need to write time.sleep (time.duration * (how long is the waiting time?))
A. Single Variable
For example: I want to make a system with a waiting time of 5 seconds and then I run the system again after 5 seconds.
B. Array Variable
Next, I want make a system with some duration for waiting process and use termination process handle.
First, I have data like: {5, 2, 3, 1, 3}
the mean of this data is that the system will wait 5 seconds and then display number 5,
after that it will wait 2 seconds and then display number 2,
after that it will wait 3 seconds and then display number 3,
after which it will do the waiting process for 1 second then it will display the number 1,
after that it will do the waiting process for 3 seconds then it will display the number 3
Have a nice coding :)