Logo

Programming-Idioms

History of Idiom 2 > diff from v55 to v56

Edit summary for version 56 by aefwewfaafasf:
[Elixir] Previous example was syntactically wrong

Version 55

2017-08-07, 19:40:40

Version 56

2017-09-06, 03:23:44

Idiom #2 Print Hello 10 times

Loop to execute some code a constant number of times

Illustration

Idiom #2 Print Hello 10 times

Loop to execute some code a constant number of times

Illustration
Code
for _ <- 1..10 do IO.puts "hello" end
Code
for _ <- 1..10, do: IO.puts "hello"
Doc URL
http://elixir-lang.org/docs/stable/elixir/Kernel.SpecialForms.html#for/1
Doc URL
http://elixir-lang.org/docs/stable/elixir/Kernel.SpecialForms.html#for/1
Demo URL
http://play.elixirbyexample.com/s/44301cf4c3
Demo URL
http://play.elixirbyexample.com/s/44301cf4c3