UpNext

10.2.1  Char Constants

Mythryl supports C-flavored character constants enclosed in single quotes:

    'a' 'b' 'c'

Special escapes supported are:

    '\a'            # Ascii  7 (BEL)
    '\b'            # Ascii  8 (BS)  Backspace
    '\f'            # Ascii 12 (FF)  Formfeed
    '\n'            # Ascii 10 (LF)  Newline
    '\r'            # Ascii 13 (CR)  Carriage-return
    '\t'            # Ascii  9 (TAB) Horizontal tab
    '\v'            # Ascii 11 (TAB) Vertical   tab
    '\\'            # Backslash
    '\''            # Quote
    '^@' - '^_'     # Control characters starting from NUL (Ascii 0).
    '\000' - '\255' # Character by decimal ascii value.

Nonprinting characters are not permitted within character constants; use one of the provided escapes instead.

Integer constants are of type Char; they are not integers as in C. Use char::from_int and char::to_int to coerce values between types Int and Char.


Comments and suggestions to: bugs@mythryl.org

UpNext