BETWEEN Operator

SeekVal BETWEEN LoVal AND HiVal

SeekValThe value to find in the inclusive range.
LoValThe low value in the inclusive range.
HiValThe high value in the inclusive range.

The BETWEEN operator is shorthand for an inclusive range check using standard comparison operators (SeekVal >= LoVal AND SeekVal <= HiVal). It may be combined with NOT to reverse the logic.

Example:

X := 10;
Y := 20;
Z := 15;

IsInRange := Z BETWEEN X AND Y;
   //This code is directly equivalent to:
   // IsInRange := Z >= X AND Z <= Y;

IsNotInRange := Z NOT BETWEEN X AND Y;
   //This code is directly equivalent to: 
   // IsInNotRange := NOT (Z >= X AND Z <= Y);
OUTPUT(IsInRange);
OUTPUT(IsNotInRange);

See Also: Logical Operators, Comparison Operators