GetKeyCount

(Engine-Level Function)

Description: Return a count of the number of keys stored by the given dictionary.
Returns: Numeric
Usage: Script or steady state.
Function Groups: Dictionary
Related to: ListKeys | GetNextKey
Format: GetKeyCount (Dictionary)
Parameters:  
Dictionary
Required. Any dictionary for which you wish to retrieve the key count.
Comments: Generally used in combination with ListKeys. The single parameter is required and must contain a dictionary, otherwise INVALID will be returned.

Example:

This function is typically used to examine a dictionary that was passed to a module as a parameter. The following demonstrates a simpler case:

Init [
  If 1 Main;
  [
    X = Dictionary();
    X["A"] = 42;
    X["B"] = 86;
    X["C"] = 99;
  ]
]
Main [
  NumKeys = GetKeyCount(X);
...

NumKeys will have the value, 3.