IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /docs/manual/basics.md). For the complete Mojo documentation index, see llms.txt.
Skip to main content
Version: 1.0.0b1
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).

iter

iter(var iterable: T) -> T.IteratorOwnedType

Constructs an owned iterator from an iterable.

Args:

  • iterable (T): The iterable to construct the iterator from.

Returns:

T.IteratorOwnedType: An owned iterator for the given iterable.

iter[IterableType: Iterable](ref iterable: IterableType) -> IterableType.IteratorType[iterable_is_mut, origin_of(iterable), origin_of(iterable)]

Constructs a borrowed iterator from an iterable.

Parameters:

  • IterableType (Iterable): The type of the iterable.

Args:

  • iterable (IterableType): The iterable to construct the iterator from.

Returns:

IterableType.IteratorType[iterable_is_mut, origin_of(iterable), origin_of(iterable)]: A borrowed iterator for the given iterable.