List Function - contains

This topic describes the syntax and usage of the list - contains function in Zoho Creator .

Description

The list - contains function determines whether an element is present in the List.

Syntax

list.contains("<string-to-be-searched>");

where,

string-to-be-searched is the string to be searched for, in the given list.

Return Value

Returns true if element is present in the list, otherwise false. 

Example    

colors = {"Red", "Blue", "Green", "Yellow"};
if (colors.contains("Red"))
{
  ...

In the above example, the script present in the if condition will be executed, since the value returned is "true".