Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling with kwargs #103

Closed
milankl opened this issue Sep 24, 2019 · 1 comment
Closed

Calling with kwargs #103

milankl opened this issue Sep 24, 2019 · 1 comment

Comments

@milankl
Copy link

milankl commented Sep 24, 2019

Say I have

using Parameters
@with_kw mutable struct Param
    a::Int = 1
    b::Int = 2
    c::Bool = true
end

which is called in

function RunModel(;kwargs...)
    P = Param(kwargs...)
    # do something else
end

is there a way to empty all the variables from the kwargs into the Paramstruct? I currently get a no method matching error. Hopefully I can just convert the kwargs somehow?

@milankl
Copy link
Author

milankl commented Sep 24, 2019

Nevermind, I just forgot the ;

function RunModel(;kwargs...)
    P = Param(;kwargs...)
end

@milankl milankl closed this as completed Sep 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant