Language Elements
34
NetLinx Programming Language Reference Guide
SWITCH (var)
{
CASE 1:
{
(*statements go here*)
BREAK
}
CASE 3:
{
(*statements go here*)
BREAK
}
CASE 5:
{
(*statements go here*)
BREAK
}
DEFAULT:
{
(*statements go here*)
BREAK
}
}
Loops
WHILE statements
A WHILE statement executes its statement block as long as its associated condition evaluates to true. The
condition is evaluated before the first pass through the statements. Therefore, if the conditional
expression is never true, the conditional statements are never executed. An example is:
WHILE (<conditional expression>)
{
(* conditional statements *)
}
Regarding WHILE statements:
 Statements are executed repeatedly while the conditional expression evaluates to true.
 The condition is tested before each pass through the conditional statements.
 There is no timeout period as was the case with Axcess. The original intent of the timeout
period was to prevent
WHILE loops from locking out updates to/from the AXlink bus. The
NetLinx Central Controller handles bus updates through a separate execution thread, thereby
eliminating this potential problem.
MEDIUM_WHILE statements
The MEDIUM_WHILE statement is obsolete in NetLinx. The compiler accepts the statement but converts
it internally to a
WHILE statement. For example: