venki
venki

Reputation: 413

How do you pass all keyword-arguments to an inner function?

kwargs... allows you to accept arbitrary keyword arguments, but you can access them in the form of a Dictionary. How do you pass all the provided keyword arguments to an inner function?

For example:

function bar(;kwargs...)
    print(kwargs)
end

function foo(;kwargs...)
    bar(<MODIFY ME>)
end

How do I modify the call to bar such that it receives all the keyword arguments passed into foo?

Upvotes: 3

Views: 726

Answers (1)

Bogumił Kamiński
Bogumił Kamiński

Reputation: 69949

Use:

function foo(;kwargs...)
    bar(;kwargs...)
end

(note the semicolon before kwargs)

Upvotes: 7

Related Questions