Skip to content

Modern Array Contains

Paul Squires edited this page Oct 19, 2026 · 5 revisions

Home › Array › Array Container › Contains

Contains

Returns true if any element equals the value.

Syntax

Contains( a, v ) as boolean

Examples

#import "std/containers"
using containers

dim v as Array( of int32 )
v.Push( 10 ) : v.Push( 20 )

'' T is inferred from the array, so the value must already BE a T --
'' a bare `20` is an INTEGER literal and gives error 340
dim as int32 wanted = 20
print Contains( v, wanted )      '' true

dim as int32 absent = 99
print Contains( v, absent )      '' false

'' Exactly IndexOf( ) >= 0, for the common case where the position is
'' not wanted

Library: Array Container
Category: Array
Documented under: Members

Clone this wiki locally