get()
Table of Contents
Overview
The get() function takes listVariable and indexValue as arguments. It returns the element present in the specified index in the list.
Note: Index starts from 0.
Return Type
- The return type will depend on the data type of the returned element.
Syntax
<variable> = <listVariable>.get( <indexValue> );
Parameter | Description | Data type |
---|---|---|
<variable> | Variable which will contain the returned element. | AS APPLICABLE |
<listVariable> | The list variable from which the element in the specified indexValue will be returned. | LIST |
<indexValue> | The index of the element which will be returned. Value should not be a negative number. If a negative number is specified, a runtime error will be encountered. Value should not exceed the list size. Ideally, this limit will be list size minus 1, since index starts from 0. | NUMBER |
Examples
listVar = {"Creator", "CRM", {"Projects", "Reports"}};
elementValue = listVar.get(2); //returns {"Projects", "Reports"}
elementValue = listVar.get(2); //returns {"Projects", "Reports"}