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)
Convert ConstIter to Bool (true).

Returns

true
init(i:ConstIter, val:Any)
Constant iterator constructor.

Parameters

valthe constant value to use in next() and peek()
next(i:ConstIter)
Return the constant iterator value.
peek(i:ConstIter)
Return the constant iterator value.