boundedInt function
Constructs a BoundedInt object with specified lower and upper bounds.
Example:
void main() {
// Create a bounded integer type for values between 1 and 10
BoundedInt bounded = boundedInt(1, 10);
// Compare two integers using the bounded ordering
bool result1 = bounded.compare(5, 8) < 0; // Output: true (5 is less than 8)
bool result2 = bounded.compare(15, 10) > 0; // Output: false (15 is not within the bounds)
}
Implementation
BoundedInt boundedInt(int bottom, int top) => BoundedInt(bottom, top);