ListSize()

Syntax

Result = ListSize(List())
Description
Returns the number of elements in the list. It does not change the current element. This function is very fast (it doesn't iterates all the list but uses a cached result) and can be safely used to determine if a list is empty or not.

Parameters

List() The name of your list variable, created with the NewList function. You must include the brackets after the list name.

Return value

The total number of elements in the list.

Example

  NewList countme.w()

  ; Small loop to add some elements to the list.
  For i=0 To 10
    AddElement(countme())
    countme() = i * 23
  Next

  ; Show how many elements there are in the list. I hope you thought
  ; of the same value as this example ;)
  MessageRequester("Information", "There are "+Str(ListSize(countme()))+" elements in the list", #PB_MessageRequester_OK)

See Also

ListIndex()

Supported OS

All

<- ListIndex() - List Index - MergeLists() ->