SiMX Help‎ > ‎The Target Platform‎ > ‎Objects‎ > ‎TARGET Object‎ > ‎target.hash_table‎ > ‎

AddOnce


Platform Objects


Description

Calling target.hash_table.AddOnce adds a key and a value to the hash table only if there is no value under that existing key. If the specified key already has a value associated with it then nothing occurs. 

Syntax


trg.hash_table.AddOnce key, value

Key - Input the key of the value you want to add.
Value - Input the value you want to add.

Return value


This function returns a boolean true/false result depending on whether the value was added or not.

Sample

'---------- Start ----------
Function Start
Dim retval

trg.hash_table.Add "a", 11
if trg.hash_table.AddOnce( "a", 66 ) = false then
trg.Message( "The value was not added" )
else trg.Message( "The value was added" )
end if
End Function

In this case the value would not be added because there is already a value associated with the "a" key.

See also