Task

The goal is to create an associative array (also known as a dictionary, map, or hash).



Related tasks:

 Associative arrays/Iteration
 Hash from two arrays


See also

 Array
 Associative array: Creation, Iteration
 Collections
 Compound data type
 Doubly-linked list: Definition, Element definition, Element insertion, List Traversal, Element Removal
 Linked list
 Queue: Definition, Usage
 Set
 Singly-linked list: Element definition, Element insertion, List Traversal, Element Removal
 Stack


mata
a=asarray_create()
 
// Add entries
asarray(a,"one",1)
asarray(a,"two",2)
 
// Check existence of key
asarray_contains(a,"two")
 
// Get a vector of all keys
asarray_keys(a)
 
// Number of entries
asarray_elements(a)
 
// End Mata session
end