Escape sequences

Some scripts may need to print characters reserved by the language, or characters that cannot be typed on a standard keyboard layout. To help with this, Rant offers escape sequences.

Character escapes

Any reserved character can be printed by prefixing it with \:

\{This text will print with braces around it\}

Special escapes

Certain characters are not interpreted verbatim when escaped, and instead have special meaning. Here's a list of them:

Escape sequenceOutput character
\\Backslash
\nLine feed (U+000A)
\rCarriage return (U+000D)
\sSpace (U+0020)
\tTab (U+0009)
\0Null character (U+0000)
\xXXByte escape [See below]
\uXXXX16-bit Unicode escape [See below]
\UXXXXXXXX32-bit Unicode escape [See below]
\U(XXXXXXXX)Unsized Unicode escape [See below]

Unicode escapes

Escape sequences can also be used to specify arbitrary Unicode characters by their hexadecimal form:

# Byte escape
\xE4    # 'ä'

# 16-bit Unicode escape
\u2705 # ✅

# 32-bit Unicode escape
\U0001F602 # 😂

# Unsized Unicode escape (1-8 digits)
\U(1f629)\U(1f44c) # 😩👌