# static create()

## `Range.create()`

The static `create()` method returns a new instance of [`Range`](/range/overview.md) with a range of the given required [`min`](#min-min), [`max`](#max-max) and optional current [`value`](#value-number), [`step`](#step-step-1-asstep).

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

```typescript
public static create<
  Min extends number,
  Max extends number,
  Step extends number = 1
>(min: Min, max: Max, value?: number, step?: Step): Range<Min, Max, Step> {
  return new this(min, max, value, step);
}
```

{% endcode %}

### Generic type variables

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

A generic type variable constrained by the [`number`](https://www.typescriptlang.org/docs/handbook/basic-types.html#number), by default of the value **captured** from the supplied [`min`](#min-min) indicates the **minimum** range type of a new [`Range`](/range/overview.md) instance.

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

A generic type variable constrained by the [`number`](https://www.typescriptlang.org/docs/handbook/basic-types.html#number), by default of the value **captured** from the supplied [`max`](#max-max) indicates the **maximum** range type of a new [`Range`](/range/overview.md) instance.

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

A generic type variable constrained by the [`number`](https://www.typescriptlang.org/docs/handbook/basic-types.html#number), by default of the value equal to **`1`**, optionally **captured** from the supplied [`step`](#step-step-1-asstep) indicates the range step type of a new [`Range`](/range/overview.md) instance.

### Parameters

#### `min:`[<mark style="color:green;">`Min`</mark>](#minextendsnumber)

The **minimum** range of generic type variable [`Min`](#minextendsnumber) to set with a new [`Range`](/range/overview.md) instance.

#### `max:`[<mark style="color:green;">`Max`</mark>](#maxextendsnumber)

The **maximum** range of generic type variable [`Max`](#maxextendsnumber) to set with a new [`Range`](/range/overview.md) instance.

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

The optional value of the [`number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) type between the given [`min`](#min-min) and [`max`](#max-max) specifies the default value of a new [`Range`](/range/overview.md) instance.

#### `step:`<mark style="color:green;">`Step`</mark>=`1 as`[<mark style="color:green;">`Step`</mark>](/range/generic-type-variables.md#range-less-than-min-max-step-greater-than-2)

Optional step of generic type variable [`Step`](#stepextendsnumber-1) to set with a new [`Range`](/range/overview.md) instance, by default **`1`**.

### Return type

#### `Range<`[<mark style="color:green;">`Min`</mark>](#minextendsnumber)`,`[<mark style="color:green;">`Max`</mark>](#maxextendsnumber)`,`[<mark style="color:green;">`Step`</mark>](#stepextendsnumber-1)`>`

The **return type** is the [`Range`](/range/overview.md) object that takes generic type variable [`Min`](#minextendsnumber), [`Max`](#maxextendsnumber) and [`Step`](#stepextendsnumber-1).

### Returns

The **return value** is the [`Range`](/range/overview.md) instance with a range of the given required [`min`](#min-min), [`max`](#max-max) and optional current [`value`](#value-number), [`step`](#step-step-1-asstep).

## Example usage

```typescript
// Example usage.
import { Range } from '@angular-package/range';

// Returns Range {min: 4, max: 27} of Range<4, 27, 1>
Range.create(4, 27);

// Returns Range {min: 4, max: 27} of Range<4, 27, 1.5>
Range.create(4, 27, undefined, 1.5);

// Returns Range {min: 4, max: 27, value: 4} of Range<4, 27, 1.5>
Range.create(4, 27, 4, 1.5);
```


---

# 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://range.angular-package.dev/range/methods/static-create.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.
