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: 8
Eachable1
Eachable which each() calls the callback with one argument
Direct subtypes: 18

Methods

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

Returns

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

Parameters

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