Function showScreen(sc1 As Object, sc2 As Object)
...
if sc2 <> invalid then
' do something here
end if
...
End Function
showScreen(sc1, sc2)
showScreen(sc1)
Function showScreen(sc1 As Object, sc2 = invalid As Object)
...
if sc2 <> invalid then
' do something here
end if
...
End Function
"belltown" wrote:
It doesn't help that the BrightScript Language Reference does not document the syntax for optional function parameters. It mentions that optional parameters may be declared, but the syntax definition for the FUNCTION statement doesn't depict an optional parameter declaration with a default value. It does show an example with a list of function statements, two of which have optional parameters, but with no explanation that that's what they are. It's one of those things you're just supposed to know, I guess.
"RokuMarkn" wrote:
I've expanded the description of default parameter values in the doc.
--Mark
"RokuMarkn" wrote:
I've expanded the description of default parameter values in the doc.
BrightScript Debugger> f = function(x=upTime(0)): return x: end function: ? f()
1060.72
BrightScript Debugger> ? f()
1063.5
BrightScript Debugger> f = function(x=main): return x: end function: ? f()
<Function: main>
BrightScript Debugger> y = 7: f = function(x=1/y): return x: end function: ? f(8): ? f()
8
Use of uninitialized variable. (runtime error &he9)