Literals

A literal is a constant. It is "taken literally" by Iotellect - the system just takes it as it is, and uses it as a basis for calculations, etc. It is a constant value.

Iotellect Expression Language defines several types of literals:

  • Null Literal: null

  • Boolean Literals: true or false

  • Decimal Literals (0, 1, 123, -1234567890, ...)

  • Hexadecimal Literals (0x0A, 0xFFFF, ...)

  • Binary Literals (0b01, 0b00110011)

  • Octal Literals (00, 055, 01234567, ...)

  • Floating Point Literals (3.1, -44.5, 1.3E12, ...)

  • String Literals ("This is a String", 'test', ...)

String Escaping

Backslashes (\) that appear within strings must be escaped using another backslash (i.e. becomes \\).

Example: "A string with a single backslash: \\"

Quotes must be also escaped using backslash character (" , ') if the same type of quotes was used to quote the string.

Examples:

  • "There are double quotes \"inside\" this string"

  • 'There are single quotes \'inside\' this string'

A character preceded by a backslash () is an escape sequence and has special meaning. The following table shows the escape sequences:

Escape Sequence

Description

\t

Matches a tab.

\b

Matches a backspace.

\n

Matches a newline.

\r

Matches a carriage.

\f

Matches a formfeed.

Unicode Characters

Unicode characters can be inserted into a string literal by using the following syntax construction: \uhhhh

For example, to insert a Unicode character with hexadecimal code 90FA use the following syntax: \u90FA

Was this page helpful?