Skip to main content

Literals

FormTypeExamplesNotes
Decimal integerInteger0 42 100000064-bit signed. No digit separators, no suffixes. A leading - is the unary minus operator, not part of the literal.
Hex integerInteger0x7B 0XFF 0x80000x or 0X, then hex digits in either case. Gives exactly the same value as the decimal form: 0x7B == 123.
RealReal0.5 3.14159 100.0Needs digits on both sides of the dot. .5, 5. and exponents like 1e3 aren't valid.
TextText"hello" "" "Ünïcødé ✓"Double quotes only. 'a' is an error. Any Unicode text is allowed. See the escapes below.
BooleanBooltrue falseLowercase only.
Named constantIntegerVirtualKey.F5 MouseButton.RightReplaced by its number when the script compiles. See Named constants.

Integer literals are read through a 64-bit float, so anything above 2⁵³ (9,007,199,254,740,992) loses precision. Values beyond the signed 64-bit range aren't supported.

String escapes​

WriteGet
\na line feed (U+000A)
\ra carriage return (U+000D)
\ta tab
\"a double quote
\\a single backslash
\ at the end of a linenothing: a line continuation. The backslash and the line break are both dropped.
\ followed by any other characterthat character, without the backslash. "\q" is "q".
warning

Windows paths: "C:\temp\new" is not a path. \t becomes a tab and \n a line break. Double every backslash ("C:\\temp\\new"), or build the path with ShellExpandEnvironmentVariables("%TEMP%\\new").

There's no \x.. or \u.... escape. Write a Windows line ending as \r\n. A string literal can also contain a real line break. The compiler accepts it, but the editor colors the rest of the line as an unterminated string, so the \ continuation or \n is the tidier way to write a multi-line string.

path = "C:\\Users\\Public\\notes.txt"; // C:\Users\Public\notes.txt
quoted = "She said \"hi\""; // She said "hi"
twoLns = "first\nsecond"; // two lines
long = "This is all one line of text, \
split in the source for readability."; // no line break in the value