Search code examples
elixir

What does "|>" mean in elixir?


I'm reading through some code elixir code on github and I see |> being used often. It does not appear in the list of operation on the documentation site. What does it mean?

i.e.

expires_at:    std["expires_in"] |> expires_at,

Solution

  • This is the pipe operator. From the linked docs:

    This operator introduces the expression on the left-hand side as the first argument to the function call on the right-hand side.

    Examples

    iex> [1, [2], 3] |> List.flatten()

    [1, 2, 3]

    The example above is the same as calling List.flatten([1, [2], 3]).