GetNextKey |
Arrays | |
Aptilis 1 |
GetNextKey(ArrayName[])
GetNextKey gets the next key of an array. Each array has a hidden index
which you can set with SetArrayIndex
to access all its values or keys one by one.
Once you've gotten the last element available,
the hidden index goes back to the begining of the array.
This is particulary useful with arrays that use string key
indexing (rather than numbers), when you do not know
the different keys.
Return value:
Next array key.
Example 1:
a["one"] = "un" $ a["two"] = "deux" $ a["three"] = "trois" $ SetArrayIndex(a[], "begin") n = getarraysize(a[]) for i = 1 to n key = GetNextKey(a[]) $ print("The French for '", key$, "' is '", a[key$]$, "'\n") end forResult:
The French for 'one' is 'un' The French for 'two' is 'deux' The French for 'three' is 'trois' |
See also
SetArrayIndex,
GetPreviouskey,
GetArraysize,
ClearArray.