Mojo function
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): The end of the range.
Returns:
_ZeroStartingScalarRange: 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:
Returns:
_SequentialScalarRange: 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): The start of the range. - end (
Scalar): The end of the range. - step (
Scalar): The step for the range. Defaults to 1.
Returns:
_StridedScalarRange: The constructed range.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!