2 - 5 2 - 5
MELSEC-Q
2 THE BASICS OF AD51H-BASIC
(2) Labels
<Labels> are terms in lines that are specified as branch destinations for
instructions such as GOTO, GOSUB, and RESTORE, or lines that are specified
as the next data to be read. They are placed next to line numbers. When
specifying a line that includes <Label> in instructions such as the ones listed
above, it is possible to specify the line by the label instead of the line number.
• Labels are character strings that begin with an asterisk ( ). A label is
expressed as a maximum of 15 alphanumeric characters and periods,
excluding the asterisk, starting with an alphabetic character. All labels must be
distinguishable.
• Reserved words cannot be used as labels.
• The label name referred to (label name called) must be placed at the
beginning of the line.
• When a label is followed by an instruction within one line, they must be
separated using a colon (:).
• If the same label name is defined in several places, the label with the smallest
line number will always be referenced and an error will not be generated.
(3) Statements
<Statements> are instructions that are written following the BASIC syntax and
form the smallest element of a sentence.
(4) Colons (:)
Colons are symbols used to separate statements when one sentence contains
multiple statements. Sentences comprised of one statement are referred to as
simple sentences. Sentences comprised of multiple statements separated by
colons (:) are referred to as complex sentences (multi-statements).
(5) Length of one line
The length of one line must be less than 254 characters, including line number
and spaces. One program line is considered to end at the location where the
Enter key is pressed.
2.4 Spaces and Keywords
The names of the BASIC instructions and functions are keywords that have special
meanings in BASIC. A space (Character 20h shown in Appendix 4.1) should not be
entered within these keywords. Moreover, keywords, variables, arrays, constants, and
logical operators must be separated using spaces, parentheses, numerical operators,
or other symbols allowed by the syntax rules. Spaces can be used freely in all other
places, and will be ignored no matter where in the sentence they appear.
P R I N T
Error
A = B + C
OK
A=B AND C
The logical product of B and C will be entered in A
Example
A=BANDC
The contents of variable BANDC will be entered in A
REMARK
The Enter key (Enter key) will be referred to differently depending on the console
used.