OxL Reference

method List.contains

Whether some element equals x.

Example:

oxl✓ checked in CI
fn main() io {
  let xs = ["a", "b"]
  print("{xs.contains("b")} {xs.contains("z")}")
}
Output
true false

True when an element equals x.

Example:

oxl✓ checked in CI
fn main() io {
  let xs = [1, 2, 3]
  print("{xs.contains(2)} {xs.contains(9)}")
}
Output
true false
pub(api) fn contains(x: T) -> bool

Complexity. O(n).

Since. 1.0.0-beta

Parameters

NameType
xT

Returns

bool

Effects

none declared (pure unless the body says otherwise)

Defined in: std/core/collections.oxl:297

See also