Skip to content

Modern Map MapPairView

Paul Squires edited this page Oct 19, 2026 · 5 revisions

Home › Map › Map › MapPairView

MapPairView

Holds the view that Map.Pairs returns, for for each (k, v) to walk.

Syntax

MapPairView( of TK, TV )

Notes

  • Returned by Pairs( ) and consumed immediately by for each.
  • A view, not a container: it holds a pointer to the map and exists only to give for each something to iterate. It copies nothing.
  • Iteration order is unspecified, like the map's own.

Examples

#import "std/containers"
using containers

dim ages as Map( of ustring, integer )
ages.Put( "ada", 36 )

'' The named-halves form
for each kv in ages
    print kv.key & " " & kv.value             '' ada 36
next

'' The destructuring form, through Pairs( )
for each (who, age) in ages.Pairs( )
    print who & " is " & age                  '' ada is 36
next

Library: Map
Category: Map
Documented under: Members

Clone this wiki locally