11 - 20 11 - 20
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
CHR$
Function
CHaRacter $
• Returns a character whose character code is the value of the arithmetic expression.
CHR$ ( <arithmetic expression> )
Syntax
arithmetic expression
• • • •
Specify the character code to get a character.
Examples
PRINT CHR$ (&H41)
• • • •
Displays A whose character code is 41.
Description
• CHR$ function returns a character whose character code is the numeric value specified by
<arithmetic expression>.
Specify the arithmetic expression by 0 through 255 (&H00 through &HFF).
• Normally, the CHR$ function is used in order to display a special character.
• For converting from a character to a value, see the ASC function.
Program Example
10 ' Displays characters of character code from &H41 to &H5A.
20 FOR I=&H41 TO &H5A
:
' Repeats from &H41 to &H5A
30 PRINT CHR$(I);" ";
:
' Displays a character
40 NEXT I
50 END
RUN
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
OK
REMARK
See the ASC function.