Defstr ( Defines Variables That Start With A Character Of The Specified Range As The Character Type ) - Mitsubishi QD51 Programming Manual

Logic controller
Hide thumbs Also See for QD51:
Table of Contents

Advertisement

11 INSTRUCTIONS AND FUNCTIONS
DEFSTR
Instruction
• Defines variables that start with a character of the specified range as the character type.
DEFSTR
Syntax
[- <alphabetical character> ], ...
DEFSTR M, P-R
Examples
• The DEFSTR instruction defines variables that start with a character of the specified range,
Description
as the character type. It defines the type of all variables starting with a character specified
by <alphabetical character> or with a character within the range specified by <alphabetical
character-alphabetical character> as the character type.
• Specification by the type declaration statement has priority for specifying the variable type,
and the result will be as follows:
Example
• Variables defined as character type by the DEFSTR instruction and variables with the
character type declaration character '$' are regarded as the same.
Example
• If the type is not declared by the DEFSTR instruction, a variable that has a variable name
without type declaration character is regarded as a single precision variable.
11 - 53
DEFine STRing
<alphabetical character> [- <alphabetical character> ] [, <alphabetical character>
10 DEFSTR A
(Character)
20 A= "10/3"
(Integer)
30 A%=10/3
(Single precision)
40 A!=10/3
50 PRINT A, A%, A!
60 END
10 DEFSTR A
20 A= "TOKYO"
30 A$= "NAGOYA"
40 PRINT A
50 END
It is not permitted to spell as DEF STR with a space between
DEF and STR.
Be sure to spell DEFSTR in one word.
REMARK
See the DEFDBL, DEFINT and DEFSNG instructions, and Section 2.9.
Defines variables starting with M and variables
• • • •
starting with P, Q, R as character variables.
RUN
10/3
OK
RUN
NAGOYA
OK
MELSEC-Q
3
3.3333
• • • Attempted to display A,
but the value of A$ in line
30 is displayed, i.e., A=A$.
11 - 53

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents