Fuzion Logo
fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.

interval

interval

(T 
type
:
integer, from T, through option T, step T)
:
Set T
 is
[Module base]
A `from..through` interval with a given `step`.

This is a `Set T` and a `Sequence T` created by repeatedly adding `step` to `from`.
Stops before passing `through` (exceeding it for `step > 0`, falling below for `step < 0`).

Empty if `step` points away from `through`:
interval 1 2 -1 # empty: steps down, but through is up
interval 2 1 1 # empty: steps up, but through is down


A zero `step` is only allowed when `from = through`; such an interval
contains the single element `from`:
interval 5 5 0 # 5

If `through` is `nil`, the interval is unbounded and limited only by type `T` range.

This is not an interval in the mathematical sense, but rather a representation
of an arithmetic progression.
Precondition
pre
  debug: ((step.sign = 0): through = from)

Type Parameters

T
:
integer
[Module base]

Fields

from
 T
[Module base]
Start value. Included unless the interval is empty.
through
 option T
[Module base]
Inclusive bound. Included only if reachable via `from + n * step`.
`nil` means unbounded.
step
 T
[Module base]
Step size. Positive increments; negative decrements.

Functions

execute this Sequence of process+args
0.099dev (GIT hash 9b94ad4b4a4bff2bf2be7d77be2c6e1fd7683c4d)
last changed: 2026-09-23