# Documentation of keyword arguments confuses me

**URL:** <https://discourse.julialang.org/t/documentation-of-keyword-arguments-confuses-me/27524>\
**Category:** General Usage\
**Tags:** documentation\
**Created:** [August 14, 2019, 9:06am UTC](https://discourse.julialang.org/t/documentation-of-keyword-arguments-confuses-me/27524 "2019-08-14T09:06:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cserteGT3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/csertegt3/32/8283_2.png) [@cserteGT3](https://discourse.julialang.org/u/cserteGT3)\
**Post date:** [August 14, 2019, 9:06am UTC](https://discourse.julialang.org/t/documentation-of-keyword-arguments-confuses-me/27524/1 "2019-08-14T09:06:46Z")

</div>

I was trying to pass keyword arguments from function-to-function and encountered the following:

```julia
julia> function foo(x;y=10, kwargs...)
           println(x,y)
           end
foo (generic function with 1 method)

julia>

julia> function test(x; kwargs...)
           foo(x, kwargs...)
           end
test (generic function with 1 method)

julia>

julia> function test2(x; kwargs...)
           foo(x; kwargs...)
           end
test2 (generic function with 1 method)

julia> test(10)
1010

julia> test2(10)
1010

julia> test(10, y=10)
ERROR: MethodError: no method matching foo(::Int64, ::Pair{Symbol,Int64})
Closest candidates are:
  foo(::Any; y, kwargs...) at REPL[1]:2
Stacktrace:
 [1] #test#4(::Base.Iterators.Pairs{Symbol,Int64,Tuple{Symbol},NamedTuple{(:y,),Tuple{Int64}}}, ::Function, ::Int64) at .\REPL[2]:2
 [2] (::getfield(Main, Symbol("#kw##test")))(::NamedTuple{(:y,),Tuple{Int64}}, ::typeof(test), ::Int64) at .\none:0
 [3] top-level scope at none:0

julia> test2(10, y=10)
1010

```

So I have to call the function with semicolon: `test2(x; kwargs...)=foo(x; kwargs...)`. I guess this is intended, but not from the [documentation](https://docs.julialang.org/en/v1/manual/functions/#Keyword-Arguments-1), but from a [stackoverflow issue](https://stackoverflow.com/questions/36273295/julia-pass-keyword-arguments-to-another-function).  
As it wasn’t clear for me from the docs, I tought I’d open a PR to add an example about it, but wanted to ask here before, if is it only me who did not understand it?

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [August 14, 2019, 9:53am UTC](https://discourse.julialang.org/t/documentation-of-keyword-arguments-confuses-me/27524/2 "2019-08-14T09:53:41Z")

</div>

The docs you linked does already say that

> An explicit semicolon is required only for passing varargs or computed keywords as described below.
