Logo

Programming-Idioms

History of Idiom 45 > diff from v19 to v20

Edit summary for version 20 by :

Version 19

2015-09-03, 15:17:06

Version 20

2015-09-03, 21:28:43

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