JCL Help:DecLimit@Byte@Byte@Byte
JCL Help: DecLimit Function
Search in JCL Help
Search in all projects
Summary
Decrements an ordinal up to limit.
Pascal
function DecLimit(var B: Byte; const Limit: Byte; const Decr: Byte = 1): Byte; overload;
function DecLimit(var B: Shortint; const Limit: Shortint; const Decr: Shortint = 1): Shortint; overload;
function DecLimit(var B: Smallint; const Limit: Smallint; const Decr: Smallint = 1): Smallint; overload;
function DecLimit(var B: Word; const Limit: Word; const Decr: Word = 1): Word; overload;
function DecLimit(var B: Integer; const Limit: Integer; const Decr: Integer = 1): Integer; overload;
function DecLimit(var B: Cardinal; const Limit: Cardinal; const Decr: Cardinal = 1): Cardinal; overload;
function DecLimit(var B: Int64; const Limit: Int64; const Decr: Int64 = 1): Int64; overload;
Parameters
Parameters | Description |
var B: Byte | The value to conditionally decrement. |
const Limit: Byte | The decrementation limit, this is inclusive. |
const Decr: Byte = 1 | The amount to decrement. |
Return Value
B contains the decremented value if within limit, otherwise it contains the original value. This same value is returned as the function result.
Description
DecLimit decrements the specified ordinal variable by the specified value if and only if the operation will not decrement beyond the limit. For example, suppose that X equals 10, now calling DecLimit(X, 5, 2) will decrement X by 2 leaving it with 8 on return. However, calling DecLimit(X, 5, 6) will not decrement X by 6 because that would decrement X beyond the limit. On return X still contains 10.
See Also
IncLimit IncLimitClamp DecLimitClamp
About
Unit
Donator
ESB Consultancy
Contribute to this help topic
This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page