Answers for "elixir for looop"

0

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
Posted by: Guest on November-19-2020

Browse Popular Code Answers by Language