Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
6
Task/Filter/Elixir/filter.elixir
Normal file
6
Task/Filter/Elixir/filter.elixir
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
iex(10)> numbers = Enum.to_list(1..9)
|
||||
[1, 2, 3, 4, 5, 6, 7, 8, 9]
|
||||
iex(11)> Enum.filter(numbers, fn x -> rem(x,2)==0 end)
|
||||
[2, 4, 6, 8]
|
||||
iex(12)> for x <- numbers, rem(x,2)==0, do: x # comprehension
|
||||
[2, 4, 6, 8]
|
||||
Loading…
Add table
Add a link
Reference in a new issue