EasyManuals Logo

AMX NETLINX PROGRAMMING LANGUAGE User Manual

AMX NETLINX PROGRAMMING LANGUAGE
246 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #49 background imageLoading...
Page #49 background image
Language Elements
33
NetLinx Programming Language Reference Guide
Regarding SELECT...ACTIVE statements:
 Only the statements associated with the first condition evaluated to true are executed.
 If no condition evaluates to true, no statements are executed.
 Braces underneath individual ACTIVE statements are required only if multiple statements are
assigned to a given condition.
SWITCH…CASE
The SWITCH…CASE statement provides a programming structure for selective execution of code blocks
based on the evaluation of a single condition. The value of the
SWITCH expression is tested against each
CASE value (numeric constant or string literal). If a match is found, the statements associated with the
CASE are executed. All other CASE statements are ignored. If no match is found, the DEFAULT case
statements (if any) are executed. The
SWITCH expression is evaluated only once. An example is:
SWITCH (x)
{
CASE 1 : //do stuff when x = 1
{
}
CASE 2 : //do stuff when x = 2
{
}
default : // do stuff when x is not 1 or 2
{
}
}
This is programmatically the same programmatically as:
If (x = 1) //do stuff when x = 1
{
}
else if (x = 2) //do stuff when x = 2
{
}
else // do stuff when x is not 1 or 2
Regarding SWITCH...CASE statements:
 Only the statements associated with the first case that matches the value of the expression are
executed.
 If no CASE matches the SWITCH expression, the statements under the default case (if
available) are executed.
 All cases must be unique.
 Braces should be used to bracket the statements in a case. They are required only if variables
are declared within the case.
 The BREAK statement applies to the SWITCH. It takes execution to the end of the SWITCH.
Unlike the C language, cases do not fall through to the next case if a break is not used.
BREAKs are recommended between cases. For example:

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the AMX NETLINX PROGRAMMING LANGUAGE and is the answer not in the manual?

AMX NETLINX PROGRAMMING LANGUAGE Specifications

General IconGeneral
BrandAMX
ModelNETLINX PROGRAMMING LANGUAGE
CategorySoftware
LanguageEnglish

Related product manuals