hashtable = CreateHashTable({copyHash})

This function returns an object reference that points to a new hash table. An existing hash table may be copied by placing it as the optional parameter copyHash.

A hash table is a data structure used to implement an associative array, a structure that can map string keys to any type of variable.

The following example creates a hash table, adds Fred's "record", copies the hash table to newhash, then gets the name from the copy.

hashtable = CreateHashTable()

AddPerson(hashtable, "Fred", 98, "m")

newhash = CreateHashTable(hashtable)

Get newhash, n$, "name"
Print n$

Sub AddPerson(hashtable, name$, age, sex$)

put hashtable, name$, "name"
put hashtable, age, "age"
put hashtable, sex$, "sex"

End Sub

Data Structures

Become a Patron