Programming-Idioms

History of Idiom 2 > diff from v12 to v13

Edit summary for version 13 :

Version 12

2015-09-03, 13:30:16

Version 13

2015-09-03, 21:22:45

Idiom #2 Print Hello 10 times

Loop to execute some code a constant number of times

Idiom #2 Print Hello 10 times

Loop to execute some code a constant number of times

Code
number_of_times = 10

some_code = fn(_) -> 
  IO.puts "hello" 
end

Enum.each 1..number_of_times, some_code
Doc URL
http://elixir-lang.org/docs/stable/elixir/Enum.html#each/2
Demo URL
http://elixirplayground.com?gist=341475edd9189cb2e5dd