Skip to main content

Contains

Returns True if the element is in the list and False otherwise.

Contains block

Description

The Contains block returns True if the element is in the list and False otherwise. This is a code block part of the Lists drawer.

Usage

Use Contains to check if a specific element exists within a list. This is useful for validation, searching for specific values, or conditional logic based on list membership.

Syntax

Inputs:

  • A list to search in
  • An element to search for

Notes

  • Returns a boolean value (True or False)
  • Performs exact matching - the element must match exactly to return True
  • Works with any data type that can be stored in a list
  • List - Creates a list with specified elements
  • Index of in - Returns the index position of an element in a list
  • Item number in - Returns the item at a specific index in a list
  • Length of - Returns the number of items in a list