Skip to content

Modern ForEach Value

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

Home › For Each › For Each › Value

Value

Syntax

Value( )

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 -- the element the iterator is on

'' Array's Value( ) returns BYREF, so `for each byref x in v` can modify
'' elements in place. Returning byval would make that impossible.
it.Value( ) = 99
print v[ 0 ]                 '' 99

'' Only valid while IsValid( ) is true

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

Clone this wiki locally