RangeIter type

Iterates over a Range

Example

i = RangeIter(10..20)
echo(i.next())
echo(i.next())
# Output:
#   10
#   11

Direct parent types

Iter
Iterator. Parent type for all specific iterator types.
Direct subtypes: 8
Eachable1
Eachable which each() calls the callback with one argument
Direct subtypes: 18

Methods

Bool(i:RangeIter) Source: autoload/globals/Iter.ngs:276
Check whether there is at least one uniterated item in range.

Returns

Bool. true: next() will return next element. false: next() will throw NoNext
init(i:RangeIter, r:NumRange) Source: autoload/globals/Iter.ngs:250
Initialize RangeIter. Will throw NotImplemented if r.start or r.step are not Int
next(i:RangeIter) Source: autoload/globals/Iter.ngs:258
Return next item in range.
peek(i:RangeIter) Source: autoload/globals/Iter.ngs:267
Preview next element without advancing the iterator.

Returns

Any