Skip to content

CHR$

Syntax

CHR$(I)

Description

Returns a one-character string whose character has the ASCII code I. This function is commonly used to send special characters or control codes to the screen or printer.

The argument I must be in the range 0-255. Values outside this range will produce an "Illegal function call" error.

Example

10 PRINT CHR$(65)
RUN
A
Ok

10 PRINT CHR$(7)    ' Ring the bell
20 PRINT CHR$(13)   ' Carriage return
30 PRINT CHR$(10)   ' Line feed

See Also

  • ASC - Returns a numerical value that is the ASCII code of the first character of the string X$
  • HEX$ - Returns a string which represents the hexadecimal value of the decimal argument
  • INSTR - Searches for the first occurrence of string Y$ in X$ and returns the position at which the match is found
  • LEFT$ - Return the leftmost N characters from a string
  • LEN - Returns the number of characters in X$
  • MID$ - Extract a substring from the middle of a string
  • MID$ Assignment - Replace characters within a string variable
  • OCT$ - Returns a string which represents the octal value of the decimal argument
  • RIGHT$ - Return the rightmost N characters from a string
  • SPACE$ - Returns a string of I spaces
  • SPC - Prints I blanks on the terminal
  • STR$ - Convert a number to its string representation
  • [STRING](string_dollar.md) - Returns a string of length I whose characters all have ASCII code J or the first character of X
  • VAL - Returns the numerical value of string X$