method List.first
The first element, or none for an empty list.
Example:
fn main() io {
let xs: List<i32> = []
print("{[7, 8].first()} {xs.first()}")
}Вывод
7 none
The first element or none.
Example:
fn main() io {
print("{[7, 8].first()} {List<i32>.new().first()}")
}Вывод
7 none
pub(api) fn first() -> T?Сложность. O(1).
С версии. 1.0.0-beta
Возвращает
T?
Эффекты
не объявлены (чистая, пока тело не говорит иное)
Определено в: std/core/collections.oxl:420