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 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. For example, [9] will be replaced to tab. |
Example:
out "''name''[][65]" Output: "name" A
If you need literal [], to avoid replacing it to new line use [91]]. For '' use [39]'. For [digits] use [91]digits].
You can use the Text dialog to get properly escaped string. In the dialog you enter simple (nonescaped) text, and, when you click OK, it inserts escaped string constant.
Escape sequences are replaced only in string constants (in macro text). They are replaced before the macro runs. Escape sequences are not replaced in text that your macro gets at run time (for example, from a file, clipboard, etc). If you need QM escape sequences at run time, use str.escape.
Some functions have own escape sequences. They are replaced at run time. For example, str.format and other functions that support formatting, str.time, regular expression functions.
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. Example: @"String constant". It also can be used with variables.
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 replaced. 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.