diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-12-31 15:13:32 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-12-31 15:13:32 -0500 |
| commit | dbae987f1fb54da795185a03f4c00d56a639f8cd (patch) | |
| tree | 40a4d00c045c29cd9af117aa01194b8c8be4fbeb /api/nums.md | |
| parent | 0f9af5f44bd2735f34a48ceb177837a5a6ef25b0 (diff) | |
Changed is_between() to be bidirectional
Diffstat (limited to 'api/nums.md')
| -rw-r--r-- | api/nums.md | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/api/nums.md b/api/nums.md index dac5967f..1bad194d 100644 --- a/api/nums.md +++ b/api/nums.md @@ -574,15 +574,16 @@ Determines if a number is between two numbers (inclusive). Argument | Type | Description | Default ---------|------|-------------|--------- x | `Num` | The integer to be checked. | - -low | `Num` | The lower bound to check (inclusive). | - -high | `Num` | The upper bound to check (inclusive). | - +low | `Num` | One end of the range to check (inclusive). | - +high | `Num` | The other end of the range to check (inclusive). | - -**Return:** `yes` if `low <= x and x <= high`, otherwise `no` +**Return:** `yes` if `a <= x and x <= b` or `b <= x and x <= a`, otherwise `no` **Example:** ```tomo assert (7.5).is_between(1, 10) == yes +assert (7.5).is_between(10, 1) == yes assert (7.5).is_between(100, 200) == no assert (7.5).is_between(1, 7.5) == yes |
