Skip to content

Modern ForEach MoveNext

Paul Squires edited this page Oct 14, 2026 · 4 revisions

Home › For Each › For Each › MoveNext

MoveNext

Syntax

MoveNext( )

Examples

#import "std/containers"
using containers

dim v as Array( of int32 )
v.Push( 1 ) : v.Push( 2 )

dim it as ArrayIterator( of int32 ) = v.GetIterator( )
print it.Value( )            '' 1
it.MoveNext( )               '' advance -- it returns nothing
print it.Value( )            '' 2
it.MoveNext( )
print it.IsValid( )          '' false

'' The order is always IsValid -> Value -> MoveNext. An iterator that
'' advanced inside Value( ) could not be read twice.

Library: For Each
Category: For Each
Documented under: What Can Be Walked

Clone this wiki locally