Skip to content

Commit

Permalink
doc: add parens to example |> docstring (JuliaLang#36155)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonniedie authored and LilithHafner committed Mar 8, 2022
1 parent 12d887e commit d604d3e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion base/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -901,10 +901,11 @@ widen(x::Type{T}) where {T} = throw(MethodError(widen, (T,)))
|>(x, f)
Applies a function to the preceding argument. This allows for easy function chaining.
When used with anonymous functions, parentheses are typically required around the definition to get the intended chain.
# Examples
```jldoctest
julia> [1:5;] |> (x->x.^2) |> sum |> inv
julia> [1:5;] .|> (x -> x^2) |> sum |> inv
0.01818181818181818
```
"""
Expand Down

0 comments on commit d604d3e

Please sign in to comment.