ABB ST语言编程(5)
时间:2025-07-06
时间:2025-07-06
System 800xA Training
13.3Basic Language Elements
This section gives a very brief review of the structured text language.
13.3.1AssignmentStatements
An assignment statement assigns a value to a variable.
The statementhas two parts:
Result := In1 AND In2 OR In3;
The left hand side, before the assignment operator (:=) is called theassigned variable.The right hand side is anexpression whichis evaluated to give a value to the assignedvariable.
In the above example the expression results in a Boolean– true/false value. (It is aBoolean expression). The AND and the OR are referred to asoperators(In this caseBoolean operators).
NOTE!The := symbol is used for the assignment of operatorsand a statement must be ended with a semi-colon.
Another example of an assignment statement:
AverageFlow := (Flow1 + Flow2)/2;
The variableAverageFlow is assigned the value given by the result of the calculationon the right. Flow1 is firstly added to Flow2 and then the total is divided by 2.
The expression on the right is a Real expression because it results in a Real value(floating point value). The symbols + and / are called arithmetic operators becausethey perform arithmetic operations on the variable values which follow them.
13.3.2CommentStatementsOperator
(*…*)
(#…#)-3.
It is normally not possible to have comments withincomments (nested comments):
(* This is not (* Inner Comment *) allowed *)
However there is an alternative comment symbol that allows this:
(# This is (* Inner Comment *) allowed #)
This is useful for commentingout large blocks of code containing comments.
Chapter13-5
上一篇:小学二年级平移练习题