Skip to content

Commit 2e6f248

Browse files
aramirezreyesfredrikekre
authored andcommitted
Added docstring for -> (JuliaLang#40470)
Co-authored-by: Fredrik Ekre <[email protected]>
1 parent dba2a7a commit 2e6f248

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

base/docs/basedocs.jl

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,32 @@ the last expression in the function body.
602602
"""
603603
kw"function"
604604

605+
"""
606+
x -> y
607+
608+
Create an anonymous function mapping argument(s) `x` to the function body `y`.
609+
610+
```jldoctest
611+
julia> f = x -> x^2 + 2x - 1
612+
#1 (generic function with 1 method)
613+
614+
julia> f(2)
615+
7
616+
```
617+
618+
Anonymous functions can also be defined for multiple argumets.
619+
```jldoctest
620+
julia> g = (x,y) -> x^2 + y^2
621+
#2 (generic function with 1 method)
622+
623+
julia> g(2,3)
624+
13
625+
```
626+
627+
See the manual section on [anonymous functions](@ref man-anonymous-functions) for more details.
628+
"""
629+
kw"->"
630+
605631
"""
606632
return
607633

0 commit comments

Comments
 (0)