Skip to content

Iterator

Deprecated

The iterator is a special object that can be used to iterate over a collection of objects. It is used in the for loop.

Usage

nvs

In this case, for actually is called a.iter().next() to get the iterator.

Methods

next

Returns the next value in the iterator, if there is no next value, it will return nil.

nvs

has_next

Check is there a next value in the iterator. Return true when has next value, otherwise return false.

nvs

collect

Collect all the values in the iterator into a Array.

nvs