Skip to content

Commit 5ac0020

Browse files
authored
doc: add parens to example |> docstring (#36155)
1 parent fe1264a commit 5ac0020

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

base/operators.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -901,10 +901,11 @@ widen(x::Type{T}) where {T} = throw(MethodError(widen, (T,)))
901901
|>(x, f)
902902
903903
Applies a function to the preceding argument. This allows for easy function chaining.
904+
When used with anonymous functions, parentheses are typically required around the definition to get the intended chain.
904905
905906
# Examples
906907
```jldoctest
907-
julia> [1:5;] |> (x->x.^2) |> sum |> inv
908+
julia> [1:5;] .|> (x -> x^2) |> sum |> inv
908909
0.01818181818181818
909910
```
910911
"""

0 commit comments

Comments
 (0)