Literals

Numeric Literals

Type

Example

Description

Integer literal

-12, 0, 123_4, +9854


Real literal

0.0, 0.45, 3.1415_59


Real literal with exponent

-1.34E-12, -1.34e-12, 1.0E+6, 1.0e+6, 1.234E6, 1.234e6


Binary literal

2#1111_1111

255 in decimal

Octal literal

8#377

255 in decimal

Hexadecimal literal

16#FF or 16#ff

255 in decimal

Logic zero and one

FALSE TRUE


Typed literal

INT#-123

Presenting INT of decimal value -123

INT#16#7FFF

Presenting INT of decimal value 32767

WORD#16#AFF

Presenting WORD of decimal value 0AFF

WORD#1234

Presenting WORD of decimal value 1234

UINT#16#89AF

Presenting UINT if hexadecimal value 89AF

BOOL#0


BOOL#1


BOOL#FALSE


BOOL#TRUE


Character string literals support only double-byte coded characters.

Character String Literals

Type

Example

Description

String

"OK", 'OK'


Character

"O", 'O'


Typed string

WSTRING#"OK"

Typed double-byte string with double quotes.

Typed character

WCHAR#"O"

Typed double-byte character with double quotes.

Typed string

WSTRING#'OK'

Typed double-byte string with single quotes.

Typed character

WCHAR#'O'

Typed double-byte character with single quotes.

Duration literals do not support microseconds and nanoseconds.

Time Duration Literals

Type

Example

Short prefix without underscore.

T#14ms, T#-14ms, T#14m, T#14h t#14d t#25h15m, t#5d14h12m18s3ms,

t#12h4m34ms.

Long prefix without underscore.

TIME#14ms, TIME#-14ms, time#14s.

Date and Time of Day Literals

Type

Example

Date

DATE#1984-06-25, date#2010-09-22, 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.360, DT#1984-06-25-15:36:55.360

Was this page helpful?