Iteration (Enum)
There are no loops in Elixir; iteration is done using Enum.each, Enum.map, and Enum.sum.
Simple enough for a 5-year-old to understand
Iterate with Enum.each
Instead of for/while, Enum.each is used. 1..3 is a range (inclusive of 3).
Enum.each(1..3, fn i -> IO.puts(i)end)🎯 Exercise & Practice
Test what you've learned — answer, write code, check instantly. (1 left)
🎯 Expected output: 1
2
3
4
5