Logo

Programming-Idioms

History of Idiom 45 > diff from v21 to v22

Edit summary for version 22 by :

Version 21

2015-09-04, 13:28:42

Version 22

2015-09-04, 13:29:11

Idiom #45 Pause execution for 5 seconds

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

Idiom #45 Pause execution for 5 seconds

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

Code
IO.puts "hello"
:timer.sleep(5000)
IO.puts "world"
Code
IO.puts "hello"
:timer.sleep(5000)
IO.puts "world"
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