For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).
all
def all[IterableType: Iterable](iterable: IterableType) -> Bool where conforms_to(IterableType.IteratorType[iterable].Element, Boolable & Deinitable)
Checks whether all elements in the iterable are truthy.
Checks elements in order and stops at the first falsy element. An empty
iterable returns True.
For example:
print(all([1, 2, 3])) # True
print(all([1, 0, 3])) # False
Parameters:
- IterableType (
Iterable): The type of the iterable. Its elements must conform toBoolableandDeinitable.
Args:
- iterable (
IterableType): The iterable to check.
Returns:
Bool: True if all elements are truthy, False otherwise.
def all(var iterable: T) -> Bool where conforms_to(T.IteratorOwnedType.Element, Boolable & Deinitable)
Checks if all elements in the iterable are truthy, consuming the iterable.
Args:
- iterable (
T): The iterable to consume and check.
Returns:
Bool: True if all elements in the iterable are truthy, False otherwise.