Comments
Line Comment
<st-code> // <comment>
Text between ‘//
’ and the end of line is treated as comment in ST
-Code.
Example:
{
VAR
i : INT; // this variable is primarily used in FOR-loops for counting
END_VAR
}
/* */ Comment
<st-code> /* <comment>
<comment> */ <st-code>
Text between ‘/*
’ and ‘*/
’ is treated as comment in ST
. This type of comment may be nested up to a depth of 3. The ‘/*…*/
’-style comment may appear anywhere between literals, keywords, identifiers and special symbols. It may also contain G
-Code lines.
Example:
The following example demonstrates the notation of comments in ST
-Code. The first comment is placed within a variable declaration. The second comment encloses an entire ST
-loop. The comment contains further comments and a G
-Code line, which itself contains a G
-Code comment.
{
VAR i /* used for counting */ : INT; END_VAR
/* The following loop is commented out.
FOR i := 0 TO 10 DO
/* zigzag pattern */
! G01 (linear interpolation) X=i Y{i MOD 2} F6000
// end of loop
END_FOR;
*/
}
(* *) Comment
<st-code> (* <comment>
<comment> *) <st-code>
Text between ‘(*
’ and ‘*)
’ is treated as comment in ST
. This type of comment may be nested up to a depth of 3. It is similar to the /*…*/
-style comment.