Declarations ​
pascal
function Constrain(const Value, Lo, Hi: Integer): Integer; overload;
function Constrain(const Value, Lo, Hi: Single): Single; overload;Overload Details
Overload 1 ​
pascal
function Constrain(const Value, Lo, Hi: Integer): Integer; overload;Constrains an Integer value to [Lo..Hi].
| Parameter | Type | Description |
|---|---|---|
Value | Integer | The integer value to constrain. |
Lo | Integer | Lower boundary. |
Hi | Integer | Upper boundary. |
| Type | Description |
|---|---|
Integer | Value clamped to range [Lo..Hi]. |
Overload 2 ​
pascal
function Constrain(const Value, Lo, Hi: Single): Single; overload;Constrains a Single floating-point value to [Lo..Hi].
| Parameter | Type | Description |
|---|---|---|
Value | Single | The floating-point value to constrain. |
Lo | Single | Lower boundary. |
Hi | Single | Upper boundary. |
| Type | Description |
|---|---|
Single | Value clamped to range [Lo..Hi]. |
Description ​
Constrain restricts Value to lie within the closed range [Lo..Hi]. If Value is less than Lo, Lo is returned; if Value is greater than Hi, Hi is returned; otherwise Value is returned unchanged.