Early exit from function?
Suppose I have the following function:
'------------------------------------
Function foo(x as Integer) as Integer
If (x < 1) Then
foo = 1 ' Exit point?
End If
MsgBox "I hope I don't get this far."
foo = 2
End foo
'-----------------------------------
Ideally, I'd like the function to exit as soon as I assign
a value to the function name. So, if x = 0, then I'd like
to immediately exit and have foo return 1.
Is there a way to have functions exit as soon as they are
assigned a value? Or do I need to hook up a bunch of
"Goto" statements that jump to the last line?
-Robert
|