Logo

Programming-Idioms

History of Idiom 45 > diff from v35 to v36

Edit summary for version 36 by programming-idioms.org:
[Elixir] No need for sample context

Version 35

2016-09-22, 15:19:15

Version 36

2016-11-30, 22:14:07

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
IO.puts "hello"
:timer.sleep(5000)
IO.puts "world"
Code
:timer.sleep(5000)
Comments bubble
Elixir can leverage Erlang's stdlib, one of them is the :timer module, which has a sleep(milliseconds) function.
Comments bubble
Elixir can leverage Erlang's stdlib, one of them is the :timer module, which has a sleep(milliseconds) function.
Demo URL
http://elixirplayground.com?gist=b7e05b38a5263b46ff72
Demo URL
http://elixirplayground.com?gist=b7e05b38a5263b46ff72