for each index

 List Manipulations - for each index

The For each index Deluge List syntax executes a set of tasks repeatedly, for each element in the list and provides index starting from 0 as instance variable.

 Syntax

for each index <variable> in <list>

where,

<variable> is instance variable name which iterates each index starting from 0.
<list> the list name

 Example

In the following sample code, index_val is the user-defined instance variable name which will hold the value of the index, starting from 0, in the sports_list. If "Football" is found in the list, the user will be alerted with - "Football is available".

for each index_val in sports_list
{
if(index_val == “Football”)
{
alert “Football is available”;
}
}