|
|
|
Logical (boolean) expressions in CMUD are optimized for speed.
For example, look at the AND operation:
(expression1) AND (expression2)
This full expression is True only if BOTH expression1 AND expression2 are True. When CMUD starts running this expression, if it determines that expression1 is False, then it can stop right away and never even look at expression2. No matter what value expression2 has, if expression1 was false, then the entire full expression is also going to be false.
It is similar with OR operations:
(expression1) OR (expression2)
This is True if EITHER expression1 is True OR expression2 is True. So, when CMUD starts testing this expression, if it determines that expression1 is True, then it doesn't need to evaluate expression2 because no matter what value expression2 has, the result is still going to be true.
These optimizations help speed up scripts. It can also be used to prevent accessing undefined variables. For example:
Code: |
ComVar = %comcreate("Outlook.Application")
#IF (@ComVar AND (@ComVar.GetNameSpace("MAPI").Folders(1) = "InBox")) {...} |
In this case, if the @ComVar isn't defined, then the GetNameSpace property is never referenced, which prevents a runtime error in your script. zMUD had to trap and ignore these kind of errors since the entire expression was *always* evaluated. |
|