https://github.com/JuliaLang/julia/issues/30252
https://docs.julialang.org/en/v1/manual/functions/#Optional-Arguments-1
Julia
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: https://docs.julialang.org
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.7.0 (2018-08-08 06:46 UTC)
_/ |\__'_|_|_|\__'_| | Official http://julialang.org/ release
|__/ | x86_64-w64-mingw32
julia> function Date(y::Int64, m::Int64=1, d::Int64=1)
err = validargs(Date, y, m, d)
err === nothing || throw(err)
return Date(UTD(totaldays(y, m, d)))
end
Date (generic function with 3 methods)
julia> Date(2000, 12, 12)
ERROR: UndefVarError: validargs not defined
Stacktrace:
[1] Date(::Int64, ::Int64, ::Int64) at .\REPL[1]:2
[2] top-level scope at none:0
julia> function Re_Date(y::Int64, m::Int64=1, d::Int64=1)
err = validargs(Re_Date, y, m, d)
err === nothing || throw(err)
return Re_Date(UTD(totaldays(y, m, d)))
end
Re_Date (generic function with 3 methods)
julia> Re_Date(2000, 12, 12)
ERROR: UndefVarError: validargs not defined
Stacktrace:
[1] Re_Date(::Int64, ::Int64, ::Int64) at .\REPL[3]:2
[2] top-level scope at none:0
julia> Re_Date(2000, 12)
ERROR: UndefVarError: validargs not defined
Stacktrace:
[1] Re_Date(::Int64, ::Int64, ::Int64) at .\REPL[3]:2 (repeats 2 times)
[2] top-level scope at none:0
julia>
julia> versioninfo()
Julia Version 0.7.0
Commit a4cb80f3ed (2018-08-08 06:46 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-6.0.0 (ORCJIT, haswell)