An integer constant is an integer number. It can be in 3 formats:
1) Decimal. Examples: 47, -2000000000
2) Hexadecimal. Examples: 0x2F, 0x88CA6C00
3) Character in single quotes (character value 1 to 255). Examples: 'a', '.', ' '.
Type of integer constant depends on its value (without -), or suffix letter:
| Type | Value | Letter |
| int | 0 to 2,147,483,647 | I |
| unsigned int | 2,147,483,648 to 4,294,967,295 | U |
| long | more than 4,294,967,295 | L |
A double constant is a non-integer number. Type - double. Examples: 5.12, 0.975E-5, -2E10.
Note: Character constants must consist of single byte. In Unicode mode, non ASCII characters consist of 2-4 bytes and therefore cannot be used.
A string constant is text in double quotes. Type - lpstr. Example: "notepad.exe".
String constants cannot contain newlines and double quotes inside. Instead, use these escape sequences:
| Escape sequence | Is replaced to |
| [] | Line break (carriage return+linefeed) |
| '' | " |
| [digits] | Any character. Digits is character code. In Unicode mode, must be < 128. In ANSI mode, must be < 256. |
Tips: If you need literal [], to avoid replacing it to new line you can use [91]]. For '' you can use [39]'. Similar with [digits]. You can use the Text dialog to get properly escaped string. In the Text dialog you enter simple (nonescaped) text, and, when you click OK, it inserts escaped string. See also: str.escape.
Example:
out "''name''[][169]" Output: "name" ©
Use operator L to create Unicode UTF-16 string constant. Example: L"String constant". However all characters must be in range 1-255 (in ANSI mode) or 1-127 (in Unicode mode).
QM 2.3.0. You can instead use operator @. It converts to UTF-16 at run time. If QM is running in Unicode mode, the string can contain any characters. Example: @"String constant".
Multiline strings can be created using []. Example: "line1[]line2[]line3". Alternatively, you can place all text in other macro, and populate str variable with content of that macro. Example: str s.getmacro("big string").
Multiline strings also can be embedded in current macro, as block of comments that is assigned to a lpstr or str variable. Example:
lpstr s= this is multiline string out s
In such multiline strings, escape sequences are not processed. For example, [] is not new line.
Make sure that there are no empty lines. An empty line terminates the multiline string, even if it is followed by more comments. To add new line characters to the end, add line containing just one space.
QM 2.3.0. In the comments block, some or all lines can begin with tabs (before space). The tabs are removed. In previous versions, tabs are not allowed.
The variable must be in simplest form. For example, it can be s but cannot be t.s or a[i]. It must not be a member variable.
You can use the def statement to define named constants of any type.