2
votes

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?

1

1 Answers

6
votes

Use:

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

(note the semicolon before kwargs)