Hash Add

Purpose

Adds an element to a hash table.

Syntax

Hash Add name[[key$]] [Before | After idx] , element

Description

Hash Add adds an element to the hash table name. Optionally, the element can be inserted before or after a specified index idx.

Hash Add ht[ [key$] ] Before idx, value

Hash Add ht[ [key$] ] After idx, value

An element can also be added without a key. Unless Before or After is used, the element is placed at the end (tail) of the table.

Hash Add ht[], value adds a value at the tail of the hash table.

Example

Dim ha As Hash Variant, v As Variant

Hash Add ha["new"], 2.3

Hash Add ha[], " a string"

Hash Add ha["Time"] Before 2, Now

Hash Add ha[] After 2, PI

For Each v In ha[]

Print ha[$ Each], v

Next

Remarks

See Hash for more information on the Hash table.

See Also

Hash Erase, Hash Input, Hash Load, Hash Remove, Hash Save, Hash Sort, Hash Write

{Created by Sjouke Hamstra; Last updated: 08/10/2014 by James Gaite}