List data type
Overview
List is a data-type which can hold a collection of values. Each value present in the list is called an element.
A list can contain elements of different types say number, text, date etc. grouped together. You can also restrict the list to only accept values of a specific data-type using special qualifiers. In general, a list provides methods to store, retrieve and manipulate an aggregate of elements.
The limit to the number of elements that can be added depends on the method of addition:
- Assigning the elements directly - No limit
- Using the add builtin function - No limit (they need to be added one by one)
- Using the addAll builtin function - 25,000 elements
Note: The index value for list data-type is 0.
Example
ZohoProducts = {"Creator", "CRM", "Projects", "Campaigns"};
Elements in a list can be subject to various operations such as:
- Positional Access - Manipulate elements based on their numerical positional in the list. For example, functions such as contains(), get(), and remove().
- Search - Search for elements in a list and return their numeric position. For example functions like indexOf(), lastIndexOf().
- Range - Perform range operations like sublist().
- Unique functions - Perform unique functions like intersect(), sort(), etc.