Skip to content

Modern OrderedMap Put

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

Home › OrderedMap › OrderedMap and OrderedSet › OrderedMap.Put

OrderedMap.Put

Stores a value under a key, replacing any old one; returns true if the key was new.

Syntax

Put( k, v ) as boolean

Examples

#import "std/containers"
using containers

dim ages as OrderedMap( of ustring, integer )

print ages.Put( "bob", 41 )      '' true -- the key was new
print ages.Put( "bob", 42 )      '' false -- existed, and was OVERWRITTEN
print ages[ "bob" ]              '' 42

'' The ordering contract is '<' on TK and nothing else -- no HashOf and
'' no '=' are needed, unlike containers.Map

Library: OrderedMap and OrderedSet
Category: OrderedMap
Documented under: Members

Clone this wiki locally