aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-02-13 15:21:00 -0500
committerBruce Hill <bruce@bruce-hill.com>2025-02-13 15:21:00 -0500
commitc4479e4bd61fb2c68fdac2637a20d6d99f7b9552 (patch)
treed6cc4335d64ad9d8be9e375f6e820cfcccd153df /docs
parent5be955904682300153af0abdfd6b711b9da2ac8f (diff)
Add Int:onward() iterator
Diffstat (limited to 'docs')
-rw-r--r--docs/integers.md31
1 files changed, 31 insertions, 0 deletions
diff --git a/docs/integers.md b/docs/integers.md
index b6600314..84f33414 100644
--- a/docs/integers.md
+++ b/docs/integers.md
@@ -257,6 +257,37 @@ The octal string representation of the integer.
---
+### `onward`
+
+**Description:**
+Return an iterator that counts infinitely from the starting integer (with an
+optional step size).
+
+**Signature:**
+```tomo
+func onward(first: Int, step: Int = 1 -> Text)
+```
+
+**Parameters:**
+
+- `first`: The starting integer.
+- `step`: The increment step size (default: 1).
+
+**Returns:**
+An iterator function that counts onward from the starting integer.
+
+**Example:**
+```tomo
+nums := &[:Int]
+for i in 5:onward():
+ nums:insert(i)
+ stop if i == 10
+>> nums[]
+= [5, 6, 7, 8, 9, 10]
+```
+
+---
+
### `parse`
**Description:**