Sign in Join
FPDoc Onlineexperiment

VarEnsureRange function

In unit Variants

Make sure the variant is within a specified range.

Declaration

pascal
function VarEnsureRange(const AValue: Variant; const AMin: Variant; 
 const AMax: Variant): Variant

Arguments

AValue

Value to check.

AMin

Lower bound of range.

AMax

Upper bound of range.

Function result

Value limited within specified range.

Description

VarEnsureRange checks AValue and returns it if it is in the range specified by AMin, AMax. If it is less than AMin, then AMin is returned. If it is larger than AMax, then AMax is returned.

Errors

If the variants are of different types and they cannot be converted, an exception will be raised.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.