Method lfun::_iterator_next()


Method _iterator_next

mixed _iterator_next()

Description

Called in Iterator objects by foreach.

Advances the iterator one step.

Iterators start at the position before the first element, and foreach calls this function repeatedly until it returns UNDEFINED.

Calling it again after it has returned UNDEFINED will typically cause it to restart the iteration with the first element (ie the start and end sentinel values are the same).

Returns

Returns UNDEFINED if there are no more elements in the iterator. Otherwise it may return any other value, which for convenience will be used as index and/or value in case there is no lfun::_iterator_index() and/or no lfun::_iterator_value().

Note

This is the only function that is required by the iterator API.

See also

iterator_next(), lfun::_iterator_prev(), lfun::_iterator_index(), lfun::_iterator_value()