Name: keys

Type: function

Syntax: the keys of <arrayName>

Syntax: keys(<arrayName>)

Summary:
Returns a list of the <element> names in an <array>.

Introduced: 1.0

OS: mac, windows, linux

Platforms: desktop, server

Example:
the keys of myArray

Example:
repeat with thisItem = 1 to the number of lines in the keys of it

Example:
repeat for each line tKey in the keys of tArray
  put tArray[tKey] & return after tArrayContents
end repeat

Parameters:
arrayName (array):
The name of a <variable>.


Returns:
The <keys> <function> returns a list of <keys>, one per <line>.

Description:
Use the <keys> function to manage the elements of an <array>, or to
perform some action on each <element> in an <array>.

>*Note:*  The order of the <keys> is not alphabetical or chronological;
> it is based on the internal order. To obtain an alphabetical list of
> <keys>, use the <sort> <command>:

    put the keys of myArray into myVariable
    sort lines of myVariable


>*Note:*  Arrays in LiveCode are associative (also known as hash
> tables). This means that the keys of an array are strings which
> LiveCode uses to "look up" the array elements rather than numeric
> indices as in C, Pascal and other languages. Of course it is possible
> to use numeric values for array keys, but LiveCode will internally
> convert these into strings before retrieving the array elements.

References: combine (command), split (command), sort (command),
command (glossary), function (control structure), arrayEncode (function),
transpose (function), extents (function), keys (function),
variable (glossary), array (glossary), line (keyword),
element (keyword), is among the keys of (operator), properties (property)

Tags: properties

