Macaulay2 » Documentation
Packages » Macaulay2Doc » The Macaulay2 language » lists and sequences » Iterator » next
next | previous | forward | backward | up | index | toc

next -- get the next object from an iterator

Description

This gets the next object from an iterator, i.e., something returned by iterator.

i1 : iter = iterator {1, 2, 3}

o1 = iter

o1 : Iterator
i2 : next iter

o2 = 1
i3 : next iter

o3 = 2
i4 : next iter

o4 = 3

If the iterator is exhausted, then the symbol StopIteration is returned.

i5 : next iter

o5 = StopIteration

o5 : Symbol

See also

Ways to use next:

  • next(Iterator)

For the programmer

The object next is a method function.


The source of this document is in Macaulay2Doc/doc_iterators.m2:138:0.