Iterator

Overview

The Iterator object is used as an interface for iterating over a sequence of values, specialized for the for-in loop statement. This typical usage of an Iterator is as follows:

// We start with any contructed iterator.
let iterator = Iterator.from([0, 1, 2]);

// And can safely be iterated over with a for-in loop.
for (nn in iterator) Debug.println(nn);

Fields

.done

fn -> Boolean

Gets the current completion state of an Iterator.

.next

fn -> Boolean

Advances an Iterator to the next element of iteration.

.index

fn -> Number

Gets the current iteration index of an Iterator.

Statics

.from

fn [T](value: T) -> Iterator[Any]

Creates an Iterator from a given value.

.empty

fn [T = Any] -> Iterator[T]

Creates an empty Iterator value.

.dynamic

fn [T = Any](generator: Generator[T]) -> Iterator[T]

Creates an Iterator from a generator context.

On this page