The code line being “the culprit” seems to be
If ((Not (IsMissing (Extra))) And (Extra > 0) And (R > 0.001) And (R < 1000.0)) Then
The example you pointed to was last modified 2009-09-16, 17:09:05.
At that time nearly 16 years ago OO.o Basic
came with a “shorthand evaluation” of logical expressions which would exit the evaluation of that line as soon as the test for
Not (IsMissing (Extra))
came out false for the actually missing parameter.
The comparison Extra>0
would therefore never be touched in case of a missing Extra
This can’t work if the conjunction is executed completely in every case, and recent LibO Basic does it this way.
You may play with
Function ident(p)
ident = p
End Function
Sub testIt()
answer = (ident(2)<ident(1)) AND (ident(5)>ident(4))
Print answer
End Sub
Despite the fact that 2<1
is false, and the AND-expression
can’t come out true therefore, the second parenthesis is evalueted. Execute the Sub stepwise, and you will see.
Forget the code you found.
(However, AOO 4.1 does it still the old way.)
[The code also contains a misleading usage of the predefined name EXP
re-defining it implicitly.]