Type declarationsSubrange typesYou can create subranges of any signed integer, unsigned integer, character and enumeration type. The subrange type restricts the values allowed for the type, but leaves the same operations applicable. To specify a subrange type, use the following format: [typename][expression..expression] The two expressions must be constructed solely of constants. The first expression specifies the lowest value of the subrange and the second specifies the highest value of the subrange. If you do not specify typename, the two expressions must be compatible and the subrange must be a subrange of the type of the expressions. If the expressions are both integer expressions, use the following rules to determine the type from which the subrange is derived:
You can specify typename to override the above conventions or for documentary purposes. If typename is specified, both expressions must be compatible with it. Examples: TYPE SmallInt = [-128..128]; SmallCard = [0..255]; UpperCaseLetters = CHAR['A'..'Z'] Source:
|