# Variable Keword arguments should be Final

**URL:** <https://discourse.julialang.org/t/variable-keword-arguments-should-be-final/117338>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [July 22, 2024, 11:58am UTC](https://discourse.julialang.org/t/variable-keword-arguments-should-be-final/117338 "2024-07-22T11:58:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Farouk](https://avatars.discourse-cdn.com/v4/letter/f/f17d59/32.png) [@Farouk](https://discourse.julialang.org/u/Farouk)\
**Post date:** [July 22, 2024, 11:58am UTC](https://discourse.julialang.org/t/variable-keword-arguments-should-be-final/117338/1 "2024-07-22T11:58:56Z")

</div>

Hello, I am using Julia 1.10.4 and I am confused about the variable keyword arguments place.  
According to this from the docs:

> The nature of keyword arguments makes it possible to specify the same argument more than once. For example, in the call `plot(x, y; options..., width=2)` it is possible that the `options` structure also contains a value for `width` . In such a case the rightmost occurrence takes precedence; in this example, `width` is certain to have the value `2` . However, explicitly specifying the same keyword argument multiple times, for example `plot(x, y, width=2, width=3)` , is not allowed and results in a syntax error.

we can see that the variable kwargs are used before the final position, however when I use them before the final position an error occur ?

```julia
function everything(x, k = 1, y...; z..., j = "Hello")
    println(x)
    println(y)
    println(k)
    println(z)
    println(z...)
end

everything(15,16,20,21,22;v1 = 1, v2 =2)

```

I get the error:

```julia
syntax: invalid "..." on non-final keyword argument

```

---

<div class="post-metadata">

**Author:** ![\_bernhard](https://avatars.discourse-cdn.com/v4/letter/_/bc79bd/32.png) [@\_bernhard](https://discourse.julialang.org/u/_bernhard)\
**Post date:** [July 22, 2024, 12:02pm UTC](https://discourse.julialang.org/t/variable-keword-arguments-should-be-final/117338/2 "2024-07-22T12:02:13Z")

</div>

The example in the docs is - as you say - a call.  
You are however trying this syntax in the definition a function where it is not valid.

---

<div class="post-metadata">

**Author:** ![kellertuer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kellertuer/32/220707_2.png) [@kellertuer](https://discourse.julialang.org/u/kellertuer)\
**Post date:** [July 22, 2024, 12:05pm UTC](https://discourse.julialang.org/t/variable-keword-arguments-should-be-final/117338/3 "2024-07-22T12:05:40Z")

</div>

In the function definition it has to always be last (basically “collecting the rest”),  
but in a function _call_ you can pass down the `options` (maybe some “collected rest from before” sa keywords. In a call they can be passed down before, because the last occurrence of a keyword wins.  
In the concrete example, if the options would contain a width, that would be ignored, since that is set to 2 afterwards.

The same “collect the rest” also holds for the arguments (your `y...`). I n a function definition this has to be last (before the `;`).
