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
Are there any code examples left?
New code examples in category Elixir
-
Elixir 2022-02-19 23:15:17 elixir function arity
-
Elixir 2021-11-17 13:28:08 elixir join list of strings
-
Elixir 2021-11-11 19:05:20 liveview component
-
Elixir 2021-11-07 08:50:16 elixir random number
-
Elixir 2021-11-02 00:23:08 elixir time
-
Elixir 2021-10-21 09:12:05 elixir reverse list
-
Elixir 2021-10-21 02:14:04 generate random number elixir
-
Elixir 2021-10-04 05:34:01 map merge elixir
-
Elixir 2021-10-04 02:34:02 elixir write base64 to file