aboutsummaryrefslogtreecommitdiff
path: root/docs/bytes.md
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-04-07 01:17:02 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-04-07 01:17:02 -0400
commitf857f38f718fff586e373815a1bcad2701b4d983 (patch)
tree29b3e367437099f39f6fc9a4e7d1dd2f177afb59 /docs/bytes.md
parentfb4e4cef1382a5e37d99ccb8e97fe1d2a8cd7e93 (diff)
Add `is_between()` for various types
Diffstat (limited to 'docs/bytes.md')
-rw-r--r--docs/bytes.md27
1 files changed, 27 insertions, 0 deletions
diff --git a/docs/bytes.md b/docs/bytes.md
index 7cbf7b0c..2e139622 100644
--- a/docs/bytes.md
+++ b/docs/bytes.md
@@ -10,6 +10,7 @@ the `Byte()` constructor: `Byte(5)`.
# Byte Methods
- [`func hex(byte: Byte, uppercase=no, prefix=yes -> Text)`](#hex)
+- [`func is_between(x: Byte, low: Byte, high: Byte -> Bool)`](#is_between)
- [`func parse(text: Text -> Byte?)`](#parse)
- [`func to(first: Byte, last: Byte, step: Int8? = none -> Text)`](#to)
@@ -21,6 +22,32 @@ TODO: write docs
---------
+### `is_between`
+Determines if an integer is between two numbers (inclusive).
+
+```tomo
+func is_between(x: Byte, low: Byte, high: Byte -> Bool)
+```
+
+- `x`: The integer to be checked.
+- `low`: The lower bound to check (inclusive).
+- `high`: The upper bound to check (inclusive).
+
+**Returns:**
+`yes` if `low <= x and x <= high`, otherwise `no`
+
+**Example:**
+```tomo
+>> Byte(7).is_between(1, 10)
+= yes
+>> Byte(7).is_between(100, 200)
+= no
+>> Byte(7).is_between(1, 7)
+= yes
+```
+
+---
+
## `parse`
TODO: write docs