Literals
A literal is a constant value written directly in the source. logiccloud supports the IEC 61131-3 literal forms described below.
Numeric literals
Section titled “Numeric literals”Integers
Section titled “Integers”Decimal integers may use _ as a digit separator for readability.
10001_000_000A literal can be typed by prefixing it with a type name and #:
INT#42SINT#-5UDINT#1_000Number bases
Section titled “Number bases”Bit-string and integer literals can be written in other bases with a base
prefix and #. Digits may be grouped with _.
| Prefix | Base | Example |
|---|---|---|
16# | Hexadecimal | 16#FF, 16#DEAD_BEEF |
8# | Octal | 8#777 |
2# | Binary | 2#1010_0001 |
mask := 16#00FF;flags := 2#1010_1010;Real literals
Section titled “Real literals”Real literals contain a decimal point and may carry an exponent. They can be
typed with REAL# / LREAL#.
3.141591.0E-9-2.5E3LREAL#6.022E23Boolean literals
Section titled “Boolean literals”TRUEFALSEBOOL#TRUE0 and 1 are also accepted as boolean values where a BOOL is expected.
Character and string literals
Section titled “Character and string literals”Single-byte strings (STRING) are written in single quotes; double-byte strings
(WSTRING) in double quotes. Single characters use the CHAR# / WCHAR#
prefix.
'Hello, world' // STRING"Grüße" // WSTRINGCHAR#'A' // single CHARWCHAR#"Ω" // single WCHAREscape sequences
Section titled “Escape sequences”The dollar sign $ introduces an escape inside a string or character literal:
| Escape | Meaning |
|---|---|
$$ | A literal dollar sign $ |
$' | Single quote (in single-byte strings) |
$" | Double quote (in double-byte strings) |
$L / $l | Line feed |
$N / $n | Newline |
$P / $p | Form feed (page) |
$R / $r | Carriage return |
$T / $t | Tab |
$<hh> | Single-byte character by hex code (two hex digits) |
$<hhhh> | Double-byte character by hex code (four hex digits, WSTRING) |
line := 'Name:$TValue'; // tab between Name: and Valuequote := 'It$'s ready'; // embedded single quotenul := '$00'; // a NUL character by hex codeTime and duration literals
Section titled “Time and duration literals”A duration literal starts with T# (or TIME#) and combines day/hour/minute/
second/millisecond/microsecond/nanosecond components. LTIME# (or LT#)
denotes a long duration.
| Unit | Suffix |
|---|---|
| Days | d |
| Hours | h |
| Minutes | m |
| Seconds | s |
| Milliseconds | ms |
| Microseconds | us |
| Nanoseconds | ns |
T#500msT#1h30mT#2d4h30m15sLTIME#10s500msT#-100ms // durations may be negativeComponents must appear in descending order of magnitude and a fractional value is
allowed on a component (e.g. T#1.5h).
Date and time-of-day literals
Section titled “Date and time-of-day literals”| Kind | Prefix(es) | Example |
|---|---|---|
| Date | D#, DATE# | D#2026-06-08 |
| Long date | LD#, LDATE# | LD#2026-06-08 |
| Time of day | TOD#, TIME_OF_DAY# | TOD#14:30:00, TOD#14:30:00.250 |
| Long time of day | LTOD#, LTIME_OF_DAY# | LTOD#23:59:59.999 |
| Date and time | DT#, DATE_AND_TIME# | DT#2026-06-08-14:30:00 |
| Long date and time | LDT#, LDATE_AND_TIME# | LDT#2026-06-08-14:30:00.500 |
start := DT#2026-06-08-08:00:00;midday := TOD#12:00:00;today := D#2026-06-08;