Quantcast
Channel: First steps - JuliaLang
Viewing all articles
Browse latest Browse all 2795

Reference to the value of a named function argument

$
0
0

Within a function body I’d like to refer to a value of a named argument.
An example of what I have in mind, how to implement f:

function f(; arg1, arg2, argname)
    println("value of $argname is: ???")
end

so that it’s invocation produces:

julia> f(arg1 = 1, arg2 = "b", argname = "arg1")

value of arg1 is: 1

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 2795