# getRangeOfStep()

## `Range.prototype.getRangeOfStep()`

The `getRangeOfStep()` method returns a range of numbers by the specified [`step`](https://docs.angular-package.dev/range-1/range/accessors/get-step) from the [minimum](https://docs.angular-package.dev/range-1/range/properties/min) to the given [`step`](#step-number) of a specified [`Range`](https://docs.angular-package.dev/range-1/range) object.

{% code title="range.class.ts" %}

```typescript
public getRangeOfStep(step: number): Readonly<Array<number>> {
  const range = [];
  if (step > 0 && step <= this.steps) {
    for (let value = 0; value < step; value++) {
      range.push(this.min + value * this.#step);
    }
  }
  return range;
}
```

{% endcode %}

### Parameters

#### `step:`[<mark style="color:green;">`number`</mark>](https://www.typescriptlang.org/docs/handbook/basic-types.html#number)

Step of [`number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) type is the maximum range of the returned [`array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array).&#x20;

{% hint style="warning" %}
The value must be less or equal to the number of range [`steps`](https://docs.angular-package.dev/range-1/range/accessors/get-steps).
{% endhint %}

### Return type

#### [<mark style="color:green;">`Readonly`</mark>](https://www.typescriptlang.org/docs/handbook/utility-types.html#readonlytype)`<`[<mark style="color:green;">`Array`</mark>](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#arrays)`<`[<mark style="color:green;">`number`</mark>](https://www.typescriptlang.org/docs/handbook/basic-types.html#number)`>>`

### Returns

The **return value** is a range of numbers of a read-only [`Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) from [minimum](https://docs.angular-package.dev/range-1/range/properties/min) to step of the given [`step`](#step-number) if the given [`step`](#step-number) is within a range, otherwise an empty [`Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array).

## Example usage

```typescript
// Example usage.
import { Method } from '@angular-package/range';
// Create new instance.
// Returns Range {min: 3, max: 27, value: 10} of Range<3, 27, 3>.
const range = new Range(3, 27, 10, 3);

// Maximum steps is 9.
range.steps;

// Get range to step 3. Returns (3) [3, 6, 9]
range.getRangeToStep(3);

// Get range to step 9. Returns (9) [3, 6, 9, 12, 15, 18, 21, 24, 27]
range.getRangeToStep(9);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.angular-package.dev/range-1/range/methods/getrangeofstep.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
