# Is it possible to check if a function has been called with a keyword argument explicitly?

**URL:** <https://discourse.julialang.org/t/is-it-possible-to-check-if-a-function-has-been-called-with-a-keyword-argument-explicitly/90812>\
**Category:** General Usage\
**Created:** [November 25, 2022, 2:39pm UTC](https://discourse.julialang.org/t/is-it-possible-to-check-if-a-function-has-been-called-with-a-keyword-argument-explicitly/90812 "2022-11-25T14:39:04Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![halleysfifthinc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/halleysfifthinc/32/206280_2.png) [@halleysfifthinc](https://discourse.julialang.org/u/halleysfifthinc)\
**Post date:** [November 25, 2022, 4:48pm UTC](https://discourse.julialang.org/t/is-it-possible-to-check-if-a-function-has-been-called-with-a-keyword-argument-explicitly/90812/3 "2022-11-25T16:48:35Z")

</div>

My suggestion [here](https://discourse.julialang.org/t/concise-call-keyword-arg-with-default-by-conditional/90716/3) would allow this, but could be considered to make your function “messier”.

```julia
function A(x; karg1=nothing)
    if isnothing(karg1)
        karg1 = 3
    else
        # karg1 was explicitly given
    end
    # rest of function
end

```

And you could even disambiguate whether the keyword argument was explicitly given with the default value, e.g.

```julia
function A(x; karg1=nothing)
    if isnothing(karg1)
        karg1 = 3
    elseif karg1 == 3
        # karg1 was explicitly given as the default value
    end
    # rest of function
end

```

---

_[View the full topic](https://discourse.julialang.org/t/is-it-possible-to-check-if-a-function-has-been-called-with-a-keyword-argument-explicitly/90812)._
