range
result = range(a, b, [step])
Input: a, b, step · Output: result
What it is
Inclusive numeric range as a Vec, from a to b (both scalars) in increments of step (an optional positional scalar, default 1 — step= as a keyword is rejected, unlike most optional Qu arguments) — distinct from the to/a:step:b loop-range syntax.
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
result = range(a, b, [step]) | a Vec or scalarnot documented yetb Vec or scalarnot documented yetstep Vec or scalar, optionalnot documented yet | result Vec | Returns a Vec whose length depends on a, b, and step. |
Examples
From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.
r = range(0, 5)
print("range(0,5) = {r}")
output
range(0,5) = [0, 1, 2, 3, 4, 5]
from tour
How it works
range(a, b) / range(a, b, step) -> inclusive integer-ish range
From the note above this builtin in the interpreter, where the reasoning was written down as it was built.