Skip to end of metadata
Go to start of metadata

A literal is used to represent a fixed-value in the source of a particular script.

String literals

String literals may be denoted by single or double quotes.

String escape sequences

  • \\ - Double escape allows rendering of single backslash in string.
  • \n - Newline
  • \r - Return
  • \u#### - Unicode character (Example: \uAE00)
  • \### - Octal character (Example: \73)

Numeric literals

Integers can be represented in decimal (base 10), octadecimal (base 8), or hexadecimal (base 16).

A decimal integer can be expressed as any number that does not start with zero.

An octadecimal representation of an integer is possible by prefixing the number with a zero, followed by digits ranging from 0 to 7.

Hexidecimal is represented by prefixing the integer with 0x followed by numbers ranging from 0-9..A-F.

Floating point literals

A floating point number consists of a whole number and a factional part denoted by the point/period character, with an optional type suffix.

BigInteger and BigDecimal literals

You can represent BigInteger and BigDecimal literals by using the suffixes B and I (uppercase is mandatory).

Boolean literals

Boolean literals are represented by the reserved keywords true and false.

Null literal

The null literal is denoted by the reserved keywords null or nil.

Labels
  • None