Default Parmeter pass through
It would be nice if the Defaultiness of optional parameters was passed through to functions called by a function with a default parameter. For instance with this code
function Func1([defParm])
variable defParm
return func2(defParm = defParm)
end
function Func1WorkAround([defParm])
variable defParm
if (ParamIsDefault(defParm))
return func2()
else
return func2(defParm = defParm)
endif
end
function Func2([defParm])
variable defParm
if (ParamIsDefault(defParm))
print "Default"
return 0
else
print "Not Default"
return 1
endif
end
You get the following results
•func1()
Not Default
•func1WorkAround()
Default
•func1(defParm=1)
Not Default
•func1WorkAround(defParm=1)
Not Default
The workaround works fine, but when you start to have multiple default parameters it gets cumbersome
Forum
Support
Gallery
Igor Pro 10
Learn More
Igor XOP Toolkit
Learn More
Igor NIDAQ Tools MX
Learn More
+1
December 12, 2019 at 11:23 am - Permalink