Logo

Programming-Idioms

History of Idiom 45 > diff from v39 to v40

Edit summary for version 40 by programming-idioms.org:
[Elixir] +DemoURL. Fixed comments

Version 39

2017-01-03, 11:11:50

Version 40

2017-02-07, 22:09:11

Idiom #45 Pause execution for 5 seconds

Sleep for 5 seconds in current thread, before proceeding with next instructions.

Illustration

Idiom #45 Pause execution for 5 seconds

Sleep for 5 seconds in current thread, before proceeding with next instructions.

Illustration
Code
Process.sleep(5000)
Code
Process.sleep(5000)
Comments bubble
Sleeps the current process by timeout.

timeout is either the number of milliseconds to sleep as an integer or the atom :infinity. When :infinity is given, the current process will suspend forever.
Comments bubble
Sleeps the current process.

Argument is either the number of milliseconds to sleep as an integer or the atom :infinity. When :infinity is given, the current process will suspend forever.
Doc URL
https://hexdocs.pm/elixir/Process.html#sleep/1
Doc URL
https://hexdocs.pm/elixir/Process.html#sleep/1
Demo URL
http://play.elixirbyexample.com/s/411419bf3c