method List.contains
Whether some element equals x.
Example:
fn main() io {
let xs = ["a", "b"]
print("{xs.contains("b")} {xs.contains("z")}")
}Output
true false
True when an element equals x.
Example:
fn main() io {
let xs = [1, 2, 3]
print("{xs.contains(2)} {xs.contains(9)}")
}Output
true false
pub(api) fn contains(x: T) -> boolComplexity. O(n).
Since. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
x | T |
Returns
bool
Effects
none declared (pure unless the body says otherwise)
Defined in: std/core/collections.oxl:297