Value types
Every variable, argument and result holds exactly one of five kinds. A variable has no fixed type. It holds whatever was last assigned to it.
| Kind | Holds | Comes from | Truthy when | Shown as (StringFormat) |
|---|---|---|---|---|
| Bool | true / false | literals, comparisons, !, &&, ||, many builtins | it is true | true / false |
| Integer | 64-bit signed whole number | integer and hex literals, constants, integer arithmetic | it isn't 0 | 42, -7 |
| Real | 64-bit floating point | real literals, any arithmetic involving a Real | it isn't 0.0 | always six decimals: 0.500000 |
| Text | Unicode string | string literals, + on two Texts, Text builtins | it isn't empty | as is |
| Window | a window handle (HWND) | WindowGetActive, ContextGetWindow, WindowFindByTitle, … | it isn't null | 0x00000000000A0B2C |
"Truthy" is how if, for conditions, !, && and || read a value that isn't a Bool. It makes
these everyday checks work without comparing to anything:
w = WindowFindByTitle("Calculator");
if (!w) UtilityPrint("Calculator isn't open"); // null handle is falsy
text = StringTrim(ClipboardGetText());
if (text) UtilityPrint("Clipboard has: " + text); // empty Text is falsy
There's no null, undefined or "nothing" value. A builtin that finds nothing returns an empty Text,
0, -1, false or a null Window, depending on its return kind. Check for the one it uses.