[top] [prev] [next]

Text and character literals

A character literal is a pair of single quotes enclosing either a single ISO-Latin-1 printing character (excluding single quote) or an escape sequence. The type of a character literal is CHAR.

A text literal is a pair of double quotes enclosing a sequence of ISO-Latin-1 printing characters (excluding double quote) and escape sequences. The type of a text literal is TEXT.

Here are the legal escape sequences and the characters they denote:

    \n   newline (linefeed)     \f    form feed 
    \t   tab                    \\    backslash 
    \r   carriage return        \"    double quote 
    \'   single quote           \nnn  char with code 8_nnn
A \ followed by exactly three octal digits specifies the character whose code is that octal value. A \ that is not a part of one of these escape sequences is a static error.

For example, 'a' and '\'' are valid character literals, ''' is not; "" and "Don't\n" are valid text literals, """ is not.

[top] [prev] [next]