Method Iterator()->`+=()


Method `+=

Iterator() += steps

Description

Advance this iterator the specified number of steps and return it. The amount may be negative to move backwards. If the iterator doesn't support backward movement it should throw an exception in that case.

Note

foreach calls this function with a step value of 1 if _iterator_next() doesn't exist for compatibility with Pike 7.6 and earlier.

Note

foreach will call this function even when the the iterator has more than one reference. If you want to loop over a copy of the iterator, you can create a copy by adding 0 (zero) to it:

Iterator iterator;
    ...
    foreach(iterator+0; mixed index; mixed value) {
      ...
    }
Note

Even though this function is sufficient for foreach to advance the iterator, _iterator_next() is the preferred API.

See also

_iterator_next, `+, `-