Ordinal types
Ordinal types have the following characteristics:
- Ordinal types are countable and ordered. This property allows the operation of functions such as inc, ord, and dec on ordinal types to be defined.
- Ordinal types have a smallest possible value, accessible with low(type). Trying to count further down than the smallest value produces a panic or a static error.
- Ordinal types have a largest possible value, accessible with high(type). Trying to count further up than the largest value produces a panic or a static error.
Integers, bool, characters, and enumeration types (and subranges of these types) belong to ordinal types.
A distinct type is an ordinal type if its base type is an ordinal type.
当前内容版权归 nim-lang.org 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 nim-lang.org .