Documentation

Literals

Literals are direct representations of variable values.

Numerical literals

A numerical literal is a decimal number or a number with a certain base (e.g. binary). The underscore "_" character, inserted between the numbers in a numerical literal, is not relevant.

Literal Example
Integer number -12, 0, 123_4, +986
Floating point number 0.0, 0.4560, 3.14159_26
Floating point number with an exponent -1.34E-12, -1.34e-12
Binary number 2#1111_1111 (255 decimal)
Octal number 8#377 (255 decimal)
Hexadecimal number 16#FF, 16#ff (255 decimal)
Boolean number 0, 1, FALSE, TRUE
Typed number INT#-123, WORD#16#AEF, BOOL#0, BOOL#FALSE

Note: In FUPLA, literals in other numeric systems than decimal, such as 16#FF, are not supported. All values must be entered as decimal, e.g. 255.

Examples:

REAL#+INF, REAL#-INF, LREAL#+INF, LREAL#-INF //literals of special values of real numbers (+- infinity)
REAL#NAN, LREAL#NAN //literals of special values of real numbers (not a number)

Character literals

Character literals are one- or two bytes coded characters. A one-byte literal is a sequence of zero or more characters with a prefix and ending using a single quote character ('). A two-byte literal is a sequence of zero or more characters with a prefix and ending using a single quote character (").

Literal Example
One-byte characters Empty string ''
One character 'A'
Typed string STRING#'OK'
Two-byte characters Empty string ""
One character "A"
Typed string STRING#"OK"
Combinations of two characters Dollar sign $$
Apostroph $'
Quotation mark $"
Line feed (new line, 16#0A) $L or $I
Newline (new line) $N
Form feed (new page) $P
Carriage return (16#0D) $R
Tabelator (16#09) $T

Time literals

Time literals represent a duration of an event, or time period elapsed between start and end of an event. Units are days, hours, minutes, seconds, fractions of seconds, and combinations of the above.

Literal Description
d Day
h Hour
m Minute
s Second
ms Millisecond
us Microsecond
ns Nanosecond

Examples:

T#14ms, TIME#14ms, T#-14ms, LT#14.7s, t#25h15m, TIME#5m_20s_500ms

Time literals of absolute time

Literal Example
Date DATE#1984-06-25, date#1984-06-25, D#1984-06-25, d#1984-06-25
Time of day TIME_OF_DAY#15:36:55.36, TOD#15:36:55.36
Date and time DATE_AND_TIME#1984-06-25-15:36:55.360227400, DT#1984-06-25-15:36:55.360227400