6 Programming
6-80
NJ-series CPU Unit Software User’s Manual (W501)
• The two methods to insert comments are described below.
Spaces, Carriage Returns, and Tabs
• You can place any number of spaces, carriage returns, and tabs in your code at any location. This
allows you to add spaces or tabs before statements and carriage returns between operators/key-
words and expressions in order to make your code easier to read.
• Always enter a token separator, such as a space, carriage return, or tab, between operators/key-
words and variables.
Example: The square boxes indicate where you must insert a token separator, such as a space,
carriage return, or tab.
Lowercase/Uppercase, Single-byte/double-byte Characters
• Operators, keywords, and variable names are not case sensitive.
• Operators, keywords, and variable names must always be in single-byte characters. A syntax
error will occur if you input double-byte characters.
Variables and Prohibited Characters
Refer to 6-3-12 Restrictions on Variable Names and Other Program-related Names for restrictions
on variable names.
Text Strings
Refer to 6-3-12 Restrictions on Variable Names and Other Program-related Names for restrictions
on text strings.
Statement Keywords
Comment notation Examples Remarks
Enclose the comment in sin-
gle-byte parenthesis and
asterisks, for example,
“(*This is a comment*)”.
(* Commenting out multiple lines
IF ErrCode = 3 THEN
Value := 1000;
END_IF;
down to here. *)
This type of comment can span over
multiple lines. Comments cannot be
nested.
Begin the comment with two
forward slashes (//) and end
it with a carriage return.
// Comment
// A := SIN(X)^2;
You can comment out only single
lines.
IF A>0 THEN X:=10;
ELSE
X:=0;
END_IF;
ST Keywords and Operators
Keyword Meaning Example
:= Assignment d := 10;
Calling functions and
function blocks
FBname(para1 := 10, para2 := 20);
Refer to Function Block Calls on page 6-100.
RETURN Return
IF If IF d < e THEN f := 1;
ELSIF d = e THEN f :=2;
ELSE f := 3;
END_IF;