diff options
author | chriszimmerman <cjay.zimmerman@gmail.com> | 2016-10-09 07:28:23 -0400 |
---|---|---|
committer | ven <vendethiel@hotmail.fr> | 2016-10-09 13:28:23 +0200 |
commit | da26d353ae2a32edc1509049a18160bf33d07d1e (patch) | |
tree | cf53524e78bb23da45622d6d587db0e78ffbf7db /elixir.html.markdown | |
parent | a18f6a596eb30059feaa683854511ad1f6da5994 (diff) |
[elixir/en] Adds elixir documentation on the pipe operator. (#2434)
Diffstat (limited to 'elixir.html.markdown')
-rw-r--r-- | elixir.html.markdown | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/elixir.html.markdown b/elixir.html.markdown index 26a547c3..63b7aef2 100644 --- a/elixir.html.markdown +++ b/elixir.html.markdown @@ -325,6 +325,14 @@ defmodule MyMod do IO.inspect(@my_data) #=> 100 end +# The pipe operator |> allows you to pass the output of an expression +# as the first parameter into a function. + +Range.new(1,10) +|> Enum.map(fn x -> x * x end) +|> Enum.filter(fn x -> rem(x, 2) == 0 end) +#=> [4, 16, 36, 64, 100] + ## --------------------------- ## -- Structs and Exceptions ## --------------------------- |