intel MCS BASIC-52 — Intel MCS BASIC-52 Versions 1 & 1.1 Operating and Reference Manual PDF (EN)

int e l 6.3 THE CHR OPERATOR CHR( ) The CHR( ) operator is the converse of the ASC( ) operator. It converts a numeric expression to an ASCII character. EXAMPLE: >PRINT CHR(65) A Like the ASC( ) operator, the CHR( ) operator can also "pick out" individual characters in a defined ASCII string. EXAMPLE: >10 $(1)"MCS BASIC-52" >20 FOR I=1 TO 12 : PRINT CHR($(1),I), : NEXT I >30 PRINT : FOR I=12 TO 1 STEP -1 >40 PRINT CHR($(1),I), : NEXT I >RUN MCS BASIC-52 25-CISAB SCM In the above example, the expressions contained within the parentheses, following the CHR operator have the same meaning as the expressions in the ASC( ) operator.

Unlike the ASC( ) operator, the CHR( ) operator CANNOT be assigned a value. A statement such as CHR($(1),1) = H, is INVALID and will generate a BAD SYNTAX ERROR. Use the ASC( ) operator to change a value in a string. The CHR( ) operator can only be used within a print statement! - 85 -