Search code examples
arrayslivecodevariable-length-array

Return an Array Length in Livecode


I have an array with four string values "Hello","All","of", and "you". I need to display the total length of the array which is 4 and display it to label text. How to do that?


Solution

  • you can try:

    "item 2 of the extents of YourArrayName" will show you the last element number, which is in some cases the length of an array. item 1 will shoe you the first element number. Elements are sometimes also called indexes. MyArray[1],MyArray[2] etc.

    or

    put the number of elements of MyArrayName into field "Array Length"

    or

    put the number of lines of the keys of MyArrayName into field ""Array Length"