NetLinx Programming Overview
18
NetLinx Programming Language Reference Guide
Only the statements associated with the first case that matches the value of the expression are
executed. Multiple
CASE
statements can be stacked within the
SWITCH...CASE
statement. If
the value matches one of the
CASE
statements, the statements associated with the stack will be
executed.
If no
CASE
matches the
SWITCH
expression, then the statements under the default case (if
available) are executed. The default statement must be the last case within the
SWITCH...CASE
, otherwise the remaining case statements will not execute.
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
and takes execution to the end of the
SWITCH
.
Unlike C and C++, cases do not fall through to the next case if a break is not used. Because of
this,
BREAK
statements are not required between cases.
The following is the structure for the
SWITCH...CASE
statement:
SWITCH (<expression>)
{
CASE <numeric constant or string literal>:
{
(* statements for CASE 1 *)
}
CASE <numeric constant or string literal>:
{
(* statements for CASE 2 *)
}
CASE <numeric constant or string literal>:
{
(* statements for CASE n; there can be as many cases as necessary *)
}
DEFAULT <numeric constant or string literal>:
{
(* statements for DEFAULT case *)
}
}
FOR loops
FOR
loops are an alternative to traditional loops. Functionally they do the same thing, but
FOR
loops are
more readable.
FOR
loops, like
WHILE
loops, do not process input changes from the message buffer. The
structure for a
FOR
loop is shown below:
FOR (<INITIAL>;<condition>;<after pass>)
{
(* loop statements *)
}
Содержание NETLINX PROGRAMMING LANGUAGE
Страница 15: ...Table of Contents xiii NetLinx Programming Language Reference Guide...
Страница 16: ...xiv NetLinx Programming Language Reference Guide Table of Contents...
Страница 18: ...Introduction 2 NetLinx Programming Language Reference Guide...
Страница 76: ...Language Elements 60 NetLinx Programming Language Reference Guide...
Страница 106: ...Combining Devices Levels and Channels 90 NetLinx Programming Language Reference Guide...
Страница 112: ...Master To Master M2M 96 NetLinx Programming Language Reference Guide...
Страница 114: ...Mainline 98 NetLinx Programming Language Reference Guide FIG 1 Message and Mainline Processing in the NetLinx System...
Страница 182: ...Reserved Identifiers 166 NetLinx Programming Language Reference Guide...
Страница 204: ...NetLinx UniCode Functions 188 NetLinx Programming Language Reference Guide...
Страница 244: ...Appendix B Glossary 228 NetLinx Programming Language Reference Guide...
Страница 245: ...Appendix B Glossary 229 NetLinx Programming Language Reference Guide...