Skip to content

Commit

Permalink
varargs/keywords doc (#35725)
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulSoderlind authored May 5, 2020
1 parent cf123a8 commit d68243c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion doc/src/manual/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ would be a two-argument function, and this example would not work.

It is often convenient to be able to write functions taking an arbitrary number of arguments.
Such functions are traditionally known as "varargs" functions, which is short for "variable number
of arguments". You can define a varargs function by following the last argument with an ellipsis:
of arguments". You can define a varargs function by following the last positional argument with an ellipsis:

```jldoctest barfunc
julia> bar(a,b,x...) = (a,b,x)
Expand Down Expand Up @@ -586,6 +586,14 @@ function f(;x::Int=1)
end
```

Keyword arguments can also be used in varargs functions:

```julia
function plot(x...; style="solid")
###
end
```

Extra keyword arguments can be collected using `...`, as in varargs functions:

```julia
Expand Down

0 comments on commit d68243c

Please sign in to comment.