Skip to content

@lang:includes

Check whether an array contains an element.

On-chain (@lang:includes!): The element may be constant or live. Generic arrays compare canonical ABI values, preserving dynamic tuple and array boundaries.

Returns: bool

@lang:includes(value item)
NameTypeDescription
valuearraySource array
itemanyElement to search for
  • @find — find the first matching element
  • @filter — keep all matching elements

Test membership of a typed array, supporting single-word and multiword elements. Generic values use equality of their canonical ABI encodings. Search stops at the first match. Use @str.includes! for substring membership.