Logo

Programming-Idioms

History of Idiom 2 > diff from v88 to v89

Edit summary for version 89 by llama:
[Elixir] Missing H

Version 88

2019-09-26, 21:55:20

Version 89

2019-09-26, 21:55:50

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
1..10 |> Enum.each(fn _ -> IO.puts "hello" end)
Code
1..10 |> Enum.each(fn _ -> IO.puts "Hello" end)
Comments bubble
The pipe operator is very common in elixir and is used to chain function calls
Comments bubble
The pipe operator is very common in elixir and is used to chain function calls
Doc URL
https://hexdocs.pm/elixir/1.0.5/Enum.html#each/2
Doc URL
https://hexdocs.pm/elixir/1.0.5/Enum.html#each/2