xHarbour Reference Documentation > Function Reference |
Retrieves the value associated with a specified key.
HGet( <hHash>, <xKey> ) --> xValue
The function returns the value associated with the key <xKey>.
The function retrieves the value <xValue> from the hash <hHash> associated with the key <xKey>.
If the key is not found in the hash, a runtime error is raised. Use function HHasKey() to determine the existence of a key.
See also: | Hash(), HGetKeyAt(), HGetPairAt(), HGetValueAt(), HHasKey(), HSet() |
Category: | Hash functions , xHarbour extensions |
Source: | vm\hash.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The function retrieves values by key. PROCEDURE Main LOCAL hHash := Hash( "A",10, "B",20 , "C",30 , "D",40 ) ? HGet( hHash, "B" ) // result: 20 ? HGet( hHash, "D" ) // result: 40 ? HGet( hHash, "Z" ) // runtime error RETURN
http://www.xHarbour.com