Language Elements
31
NetLinx Programming Language Reference Guide
Language Elements
Statements and Expressions
A
statement
refers to a complete programming instructions such as:
Each of these statements compile, providing the referenced variables are defined.
Expressions
are sub-components of statements. The following expressions are used in the above
example:
Expressions will not compile outside the context of a statement.
It is strongly recommended that each statement appear on a separate line. The compiler cannot
enforce this since full backward compatibility with the previous Axcess language must be
maintained.
It is also strongly recommended that semicolons be used to terminate each statement (as in the
C language).
Assignments
Assignment statements include:
Variables
Output Channels
Variables
The simplest type of assignment statement is a variable, which assigns the value of an expression to a
variable. The expression may be a constant, a variable / mathematical / logical expression, or a return
from function. The data type associated with the expression should match the data type of the variable
receiving the assignment. If not, the value of the expression is typecast to match the destination variable.
An example is:
VariableName = <expression>
Output channels
This type of statement is typically used for feedback. It sends an output change to the specified channel
on the given device. An example is:
[Device, Channel] = <expression>
The expression is evaluated as follows:
Y = X
(* Variable Assignment Statement *)
X = X + 1
(* Arithmetic Assignment Statement *)
IF (Y < 10) Y = Y + 1
(* IF Statement *)
[TP, 5] = [VCR, 1]
(* Feedback Statement *)
X + 1
(* Arithmetic Expression *)
Y < 10
(* Logical Expression *)
Y + 1
(* Arithmetic Expression *)
[TP, 5]
(* I/O Device Expression *)
[VCR, 1]
(* I/O Device Expression *)
Summary of Contents for NETLINX PROGRAMMING LANGUAGE
Page 15: ...Table of Contents xiii NetLinx Programming Language Reference Guide...
Page 16: ...xiv NetLinx Programming Language Reference Guide Table of Contents...
Page 18: ...Introduction 2 NetLinx Programming Language Reference Guide...
Page 76: ...Language Elements 60 NetLinx Programming Language Reference Guide...
Page 106: ...Combining Devices Levels and Channels 90 NetLinx Programming Language Reference Guide...
Page 112: ...Master To Master M2M 96 NetLinx Programming Language Reference Guide...
Page 182: ...Reserved Identifiers 166 NetLinx Programming Language Reference Guide...
Page 204: ...NetLinx UniCode Functions 188 NetLinx Programming Language Reference Guide...
Page 244: ...Appendix B Glossary 228 NetLinx Programming Language Reference Guide...
Page 245: ...Appendix B Glossary 229 NetLinx Programming Language Reference Guide...