A Char represents a Unicode code point. It occupies 32 bits.

It is created by enclosing an UTF-8 character in single quotes.


You can use a backslash to denote some special characters:

'\'' # single quote
'\\' # backslash
'\e' # escape
'\f' # form feed
'\n' # newline
'\r' # carriage return
'\t' # tab
'\v' # vertical tab

You can use a backslash followed by an u and four hexadecimal characters to denote a unicode codepoint written:

'\u0041' # == 'A'

Or you can use curly braces and specify up to six hexadecimal numbers (0 to 10FFFF):

'\u{41}'    # == 'A'
'\u{1F52E}' # == '🔮'

To the extent possible under law, the persons who contributed to this workhave waived
all copyright and related or neighboring rights to this workby associating CC0 with it.