elixir for looop code example
Example: elixir list comprehension
iex> for n <- [1, 2, 3, 4], do: n * n
[1, 4, 9, 16]
####
> colors = [
.. "red",
.. "yellow",
.. "blue"
.. ]
> for color <- colors, do: IO.puts(color)
> red
> yellow
> blue
iex> for n <- [1, 2, 3, 4], do: n * n
[1, 4, 9, 16]
####
> colors = [
.. "red",
.. "yellow",
.. "blue"
.. ]
> for color <- colors, do: IO.puts(color)
> red
> yellow
> blue