Numeric literals

Numeric literals:

  • Start with a sign (‘+’ or ‘-‘).
  • Are at least a digit long.
  • Can have a fractional part.
  • Must not contain spaces or grouping separators (except the decimal dot separator).

Valid numeric literals are:

  • 0
  • -1
  • 123.456
  • +11
  • -.23

String literals

String literals are delimited by single or double quotes. If the string must contain the character that is used as delimiter, that character has to be escaped using ‘\’ (backslash).

Example: “Here I use \”escaping\””.

Quote delimiters

If the string is delimited by:

  • double quotes, single quotes inside the string can be written without escaping.
  • single quotes, double quotes in the string can be written without escaping.


“Here there’s no need to use escaping.”

‘Here I don\’t have a choice but to use escaping.’

‘Here I do not use escaping for this “quoted string”.’

Special characters

Special characters used inside string literals are:

  • \t = tab
  • \r = CR
  • \n = LF
  • \\ = \

Example: “This is the first line.\nThis is the second line.”

Boolean literals

Boolean literals are True and False.

Null literal

Null represents the null value.

Related Links