Inclusive and exclusive ranges
- Last Updated: March 24, 2022
- 2 minute read
- Corticon
- Version 6.3
- Documentation
Corticon Studio also gives you the
option of defining value ranges where one or both of the starting and ending values are not
inclusive, meaning that the starting and ending value is not included
in the range of values. Rulesheet using an integer value range in condition values set
shows the same Rulesheet as in Rulesheet using numeric value ranges in condition values set, but
with one difference: the value range 201..300 was changed
to (200..300]. The starting parenthesis ( indicates that the starting value for the range, 200, is excluded. It is not included in
the range of possible values. The ending bracket ]
indicates that the ending value is inclusive. Because integer1 is an integer value, and therefore no fractional values are allowed,
201..300 and (200..300] are equivalent, and the values set in Rulesheet using an integer value range in condition values set is
still complete, as it was in Rulesheet using numeric value ranges in condition values set.
All of the possible combinations of parenthesis and bracket notation for value ranges and their meanings are:
As illustrated in Rulesheet using numeric value ranges in condition values set and
Rulesheet using an integer value range in condition values set,
if a value range has no enclosing parentheses or brackets, then it is assumed to be
closed. It is, therefore, not necessary to use the [..]
notation for a closed range in Corticon Studio. In
fact, if you try to create a closed value range by entering [..], then the brackets are automatically removed. However, should either end
of a value range have a parenthesis or a bracket, then the other end must also have a
parenthesis or a bracket. For example, x..y) is not
allowed, and is correctly expressed as [x..y).
When using range notation, always ensure that x is less than y, that is, an ascending
range. A range where x is greater than y (a descending range) can result in errors during rule
execution.