Skip to content

List Contains

Type: list-contains  ·  Package: Collections Activities v1.0.3  ·  Output: bool

Checks whether a list contains an element and returns true/false. Useful to avoid duplicates or validate membership.

Looks for item in list, comparing each element by exact equality, type included:

  • Text is case-sensitive ("ana" is not "Ana").
  • A number is not equal to its text (5 is not "5"), and numbers of different types don’t match either (integer 5 is not decimal 5.0). If the list comes from another source, convert the value you look for to the same type first, for example with str(...).

It does not modify the list.

ParameterTypeDefaultDescription
listList—The list.
itemobject—The element to look for.

None.

Returns a bool: true if any element equals item, false otherwise (also for an empty list).

MessageCause and fix
'list' must be a List, got ….list is not a list (the message shows the type received, or null if the variable is empty).

Avoid adding a repeated element:

List Contains list = processed item = id → output: alreadyThere
If condition = !alreadyThere
└─ then:
Add to List list = processed item = id