Declaration ​
pascal
function SwapConstrain(const Value: Integer; Constrain1, Constrain2: Integer): Integer;Parameters ​
| Parameter | Type | Description |
|---|---|---|
Value | Integer | Integer value to constrain. |
Constrain1 | Integer | First boundary constraint. |
Constrain2 | Integer | Second boundary constraint. |
Returns ​
| Type | Description |
|---|---|
Integer | Value constrained to [min(Constrain1, Constrain2) .. max(Constrain1, Constrain2)]. |
Description ​
SwapConstrain restricts Value to the interval bounded by Constrain1 and Constrain2. Unlike Constrain, Constrain1 does not need to be less than or equal to Constrain2; SwapConstrain automatically determines the minimum and maximum of the two bounds.