Literals

String Literal

A string literal is of type STRING. It can be specified in three different ways:

  • single-quoted
  • double-quoted
  • heredoc style

Single quoted

'hello world'

Double quoted

"Hello world"

Heredoc style

After operator ‘<<<’, an identifier is provided, then a newline. The string itself follows, and then the same identifier again to close the quotation.

Allows to specify strings containing newlines.

<<<END Red fox jumps
over brown dog.END

Boolean Literal

A boolean literal has two possible values of type BOOLEAN. True or false formed from case insensitive ASCII letters.

true, false, TRUE, FALSE, True, False, tRue, fAlse

Integer Literal

An integer literal is of type INTEGER. It may be expressed in decimal (base 10 - default) or hexadecimal (base 16 - prefixed with ASCII letters 0x).

  • The largest integer literal value is 2147483647
  • The smallest integer literal value is -2147483648
  • Base 10 values out of range are automatically converted to type LONG.
0, 1, -3, 14, 1984, 0x7C0, 1555555551, -2147483648, 2147483647, 0x7fffffff

Long Literal

An long literal is of type LONG. It may be expressed in decimal (base 10 - default) or hexadecimal (base 16 - prefixed with ASCII letters 0x) suffixed with an ASCII letter L or l.

  • The largest long literal value is 9223372036854775807
  • The smallest long literal value is -9223372036854775808
0L, 1L, -3L, 14L, 1984L, 0x7C0L, -2147483648L, 2147483647L, 0x7fffffffL, 9223372036854775807

Float Literal

A float literal is of type FLOAT. It has the following parts: a decimal whole-number part, a fraction part, an exponent, and a type suffix. Suffix for float literal is an ASCII letter F or f.

  • The largest positive finite literal of type float is 3.4028235e38f.
  • The smallest positive finite non-zero literal of type float is 1.40e-45f.
0.00005f, 1.0f, 3.14f, 20f, 2.4E-24f, 3e2f, 3.4028235e38f, 1.40e-45f

Double Literal

A double literal is of type DOUBLE. It has the following parts: a decimal whole-number part, a fraction part, an exponent, and a type suffix. Optional suffix for double literal is an ASCII letter D or d.

  • The largest positive finite literal of type double is 1.7976931348623157e308.
  • The smallest positive finite non-zero literal of type double is 4.9e-324.
0.00005, 3.14, 3.14d, -17.1, -17.1d, 20d, 2.4E-24, 2.4E-24d, 3e2, 3e2d, 4.9e-324

IPV4 Address Literal

IPADDR

192.168.0.4;

IPV4 Socket Literal

IPSOCKET

192.168.0.4:443

IPV4 Network Literal

IPNET

192.168.0.4/32;

Mac Addr Literal

MACADDR can be expressed using IEEE-802 notation:

01-23-45-67-89-ab

All other data types can be expressed using casting functions.