swirl
Guide to OmniMark 9   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
Prerequisite Concepts      

Test expressions

A test expression is any expression that evaluates to either true or false. Comparisons are all test expressions. Test expressions can only be used in conditions or saved in switch items. They have no numeric or string representations.

The simplest forms of a test expression are:

Comparisons are examples of test expressions. They take either numeric, string, or test expressions as operands and produce a test value (true or false) as a result.

Test expressions can be combined with the logical operators & (and) and | (or). Test expressions can be negated with the operator ! (not).

OmniMark omits the evaluation of the second operation of an & or | expression when the result of the first operand is sufficient to determine the result of the whole expression. This is very useful when the first part of the test is used to ensure that the second part of the test will not cause an error.

Conditional evaluation also lets you take advantage of your knowledge of the behavior of your own program in order to gain some efficiency. For instance, when combining two test expressions with an & or an |, if you know that one of the operands takes significantly longer than the other, place the shorter one first so that the second, more "expensive" operand will be examined as rarely as possible.

Another technique can be used when combining two test expressions with an & and one of the expressions usually evaluates to false. Place that operand first, so that the second expression need rarely be executed. The same technique can be used when using | and one of the operands usually evaluates to true.

Prerequisite Concepts
 
   
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACY LIBRARIES ] [ ERRORS ]

OmniMark 9.1.0 Documentation Generated: September 2, 2010 at 1:35:14 pm
If you have any comments about this section of the documentation, please use this form.

Copyright © Stilo International plc, 1988-2010.