diff options
author | j-james <35242550+j-james@users.noreply.github.com> | 2021-06-18 03:10:45 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-18 12:10:45 +0200 |
commit | a250481dcde2167d568cc1b61624658419c18e69 (patch) | |
tree | 89142cd392d9f07312f51a08c38dd311e8c7df0f /doc/manual.rst | |
parent | fc76565574b86566e4a642b9aac541e025cf5de3 (diff) | |
download | Nim-a250481dcde2167d568cc1b61624658419c18e69.tar.gz |
Make the existence of high(type) clearer, especially near subranges (#18286)
* Make the existence of high(type) clearer, especially around subranges * Use a better example and dry up the wording
Diffstat (limited to 'doc/manual.rst')
-rw-r--r-- | doc/manual.rst | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/doc/manual.rst b/doc/manual.rst index 867db245b..46a40a690 100644 --- a/doc/manual.rst +++ b/doc/manual.rst @@ -989,10 +989,12 @@ 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 values have the smallest possible value. Trying to count further - down than the smallest value produces a panic or a static error. -- Ordinal values have the largest possible value. Trying to count further - than the largest value produces a panic or a static error. +- 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. @@ -1095,6 +1097,7 @@ lowest and highest value of the type. For example: type Subrange = range[0..5] PositiveFloat = range[0.0..Inf] + Positive* = range[1..high(int)] # as defined in `system` `Subrange` is a subrange of an integer which can only hold the values 0 |