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).
range
range[T: Indexer, //](end: T) -> _ZeroStartingRange
Constructs a [0; end) Range.
Parameters:
- T (
Indexer): The type of the end value.
Args:
- end (
T): The end of the range.
Returns:
_ZeroStartingRange: The constructed range.
range[T: Indexer, //](start: T, end: T) -> _SequentialRange
Constructs a [start; end) Range.
Parameters:
- T (
Indexer): The type of the start and end values.
Args:
- start (
T): The start of the range. - end (
T): The end of the range.
Returns:
_SequentialRange: The constructed range.
range[T: Indexer, //](start: T, end: T, step: T) -> _StridedRange
Constructs a [start; end) Range with a given step.
Parameters:
- T (
Indexer): The type of the start, end, and step values.
Args:
- start (
T): The start of the range. - end (
T): The end of the range. - step (
T): The step for the range.
Returns:
_StridedRange: The constructed range.
range[dtype: DType, //](end: Scalar[dtype]) -> _ZeroStartingScalarRange[dtype]
Constructs a [start; end) Range with a given step.
Parameters:
- dtype (
DType): The range dtype.
Args:
- end (
Scalar[dtype]): The end of the range.
Returns:
_ZeroStartingScalarRange[dtype]: The constructed range.
range[dtype: DType, //](start: Scalar[dtype], end: Scalar[dtype]) -> _SequentialScalarRange[dtype]
Constructs a [start; end) Range with a given step.
Parameters:
- dtype (
DType): The range dtype.
Args:
- start (
Scalar[dtype]): The start of the range. - end (
Scalar[dtype]): The end of the range.
Returns:
_SequentialScalarRange[dtype]: The constructed range.
range[dtype: DType, //](start: Scalar[dtype], end: Scalar[dtype], step: Scalar[dtype]) -> _StridedScalarRange[dtype]
Constructs a [start; end) Range with a given step.
Parameters:
- dtype (
DType): The range dtype.
Args:
- start (
Scalar[dtype]): The start of the range. - end (
Scalar[dtype]): The end of the range. - step (
Scalar[dtype]): The step for the range. Defaults to 1.
Returns:
_StridedScalarRange[dtype]: The constructed range.