aboutsummaryrefslogtreecommitdiff
path: root/api/integers.md
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-12-31 15:13:32 -0500
committerBruce Hill <bruce@bruce-hill.com>2025-12-31 15:13:32 -0500
commitdbae987f1fb54da795185a03f4c00d56a639f8cd (patch)
tree40a4d00c045c29cd9af117aa01194b8c8be4fbeb /api/integers.md
parent0f9af5f44bd2735f34a48ceb177837a5a6ef25b0 (diff)
Changed is_between() to be bidirectional
Diffstat (limited to 'api/integers.md')
-rw-r--r--api/integers.md9
1 files changed, 5 insertions, 4 deletions
diff --git a/api/integers.md b/api/integers.md
index ef3a6a60..73779021 100644
--- a/api/integers.md
+++ b/api/integers.md
@@ -138,7 +138,7 @@ assert (255).hex(digits=4, uppercase=yes, prefix=yes) == "0x00FF"
## Int.is_between
```tomo
-Int.is_between : func(x: Int, low: Int, high: Int -> Bool)
+Int.is_between : func(x: Int, a: Int, b: Int -> Bool)
```
Determines if an integer is between two numbers (inclusive).
@@ -146,15 +146,16 @@ Determines if an integer is between two numbers (inclusive).
Argument | Type | Description | Default
---------|------|-------------|---------
x | `Int` | The integer to be checked. | -
-low | `Int` | The lower bound to check (inclusive). | -
-high | `Int` | The upper bound to check (inclusive). | -
+a | `Int` | One end of the range to check (inclusive). | -
+b | `Int` | 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 `a >= x and x >= b`, otherwise `no`
**Example:**
```tomo
assert (7).is_between(1, 10) == yes
+assert (7).is_between(10, 1) == yes
assert (7).is_between(100, 200) == no
assert (7).is_between(1, 7) == yes