ConstIter type

Iterator that returns given value forever.

Example

i = ConstIter(10)
echo(i.next())
echo(i.next())
# Output:
#   10
#   10

Direct parent types

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

Methods

Bool(i:ConstIter) Source: autoload/Iter.ngs:235
Convert ConstIter to Bool (true).

Returns

true
init(i:ConstIter, val:Any) Source: autoload/Iter.ngs:225
Constant iterator constructor.

Parameters

valthe constant value to use in next() and peek()
next(i:ConstIter) Source: autoload/Iter.ngs:228
Return the constant iterator value.
peek(i:ConstIter) Source: autoload/Iter.ngs:231
Return the constant iterator value.