Skip to content

Modern Map Count

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

Home › Map › Map › Count

Count

Returns the number of entries; reading an absent key with m[ k ] adds one.

Syntax

Count( ) as int32

Examples

#import "std/containers"
using containers

dim ages as Map( of ustring, integer )
print ages.Count                 '' 0

ages.Put( "ada", 36 )
ages.Put( "ada", 37 )            '' an overwrite, not an insertion
print ages.Count                 '' 1

'' Watch for the indexer: reading an absent key INSERTS it
print ages[ "nobody" ]           '' 0
print ages.Count                 '' 2

Library: Map
Category: Map
Documented under: Members

Clone this wiki locally