Generic command for returning the length of something
LENGTH | item=Generic | Returns the length of a variable |
example:
# a String >> printn length("abcd") 4
# an array >> a = dimensions(2,3) >> printn length(a) [2 3 ] Array(2 )
Note: for workspaces, Length() returns the number of defined elements, for arrays the dimensions.
This is a generic command which may be used on nearly all Open GENIE data types but most usefully on Strings, Arrays and Workspaces.
Item (Generic)
This is an Array, String, or Workspace parameter where the type of the item is of variable length. For arrays, the length is returned as an array of integer dimension lengths, for workspaces it is the number of fields. Note that to find the overall dimensionality of an array you can use the Dimensionality() function.
RESULT = (Integer)
The length or size of the item.