Low
// Generated Code Library declaration:
function Low: Int64;
// Effective call contract:
function Low(X): Int64;
Example
procedure ScriptEvent(var Value: variant);
begin
Value := Low('Velox'); // 1
end;
Usage
Parameters
| Name | Type | Description |
|---|---|---|
X | supported value | Dynamic/static array, string or supported integer value whose value type/range is inspected. |
Pass a value or variable. A bare type identifier is not part of the verified external-call contract.
Returns
| Runtime argument type | Result |
|---|---|
| Dynamic array | 0, including an empty array |
| Static array | its declared start offset |
| String | 1, including an empty string |
Byte, Word, Cardinal, UInt64 | 0 |
ShortInt | -128 |
SmallInt | -32768 |
Integer | -2147483648 |
Int64 | -9223372036854775808 |
Additional Technical Info
Low returns the lower index of a supported array/string value or the minimum value for a supported integer storage type.
The generated declaration is incomplete: the compiler adds a required untyped argument named X after creating the displayed declaration. This external runtime helper is narrower than Delphi's compiler intrinsic. The example is fictional and source-reviewed only.
Implementation
- The compiler adds the synthetic input parameter.
- Runtime
Low_resolves the parameter's PascalScript type. - Arrays/strings return hard-coded/index metadata; integer branches return host type constants.
- The result is written to the declared
Int64return slot. - Unsupported types return failure and become a script call/type error.
Edge cases and differences from Delphi
- An empty dynamic array has
Low=0andHigh=-1; an empty string hasLow=1andHigh=0. A loop guarded only byLowis therefore unsafe for empties. - Characters, enumerations, sets, Variants, objects and pointers are not supported branches.
Lowdoes not return an enumeration's first declared member. - The value of a numeric argument is ignored; only its base type matters.
- Delphi's intrinsic supports more type-identifier and ordinal forms and can return the argument/index type. Velox fixes the return to
Int64. - Static arrays can have a non-zero or negative declared start offset; the runtime preserves that offset.
Side effects
The function does not mutate X, though the argument expression itself is evaluated normally.
Related entries
Highreturns the corresponding upper index/type boundary.MinIntValueexamines actual elements rather than a type minimum.
External references
Created 2026-07-15