PreviousNext
Help > BASICS > Symbolic Constants (TEXT)
Symbolic Constants (TEXT)

Symbolic constant in Rittle is defined as an undefined length sequence of 8-bit ASCII symbols enclosed between " double quote characters. This data type is called TEXT.

"This is a text constant"

In some cases, the text constant may need to include a double quote character, or other characters outside of the standard printable set. Rittle allows specifying any character code from within the text constant without introducing ambiguity over whether it is a closing double quote (in the particular case) or not. These special sequences are called escape codes, and always start with an underscore character followed by one or more other characters to form the needed code.

The pre-defined escape codes in Rittle are listed below:

_a ASCII code 0x07 (alert, beep)

_b ASCII code 0x08 (backspace)

_t ASCII code 0x09 (horizontal tab)

_n ASCII code 0x0a (new line)

_v ASCII code 0x0b (vertical tab)

_f ASCII code 0x0c (form feed)

_r ASCII code 0x0d (carriage return)

_e ASCII code 0x1b (escape)

_" double quote character

_ _ underscore character

 

In addition to the pre-defined escape codes, any character code may be included by entering its ASCII code directly as an escape code:

 

_NNN character with decimal code NNN

_xNN character with hexadecimal code NN

 

In some example:

"This text constant includes _"special_" escape codes and a new line_n"

In specific cases if a text constant is too long to fit within the current source line, it can be composed as a sequence of more than one text constants that are added together during compilation. In order to achieve this the text constant must be followed immediately by its continuation part preceded by an underscore character.

Important: Nothing except comments is allowed between a text constant and its continuation. Failure of this rule will result in incorrectly compiled output code.

            "This is a text constant"

Nothing else is allowed between these two lines!

_" that gets continued here"

 

At system level text constants are compiled as part of the program code and represented in the memory as zero-terminated strings. Obviously due to this fact, character with code 0 cannot reside within a text constant.