# RANGE

**The function RANGE takes two Numbers and returns a List of Numbers spanning the first Number to the second in increments of either 1 (the default) or some other specified step (optional).**

This function requires two [Numbers](../../variable-data-types/the-number-variable-data-type) as input. It outputs a [List](../../variable-data-types/the-list-data-type) of Numbers spanning the first Number to the second. By default, the numbers in this List will increase by increments of one, though the RANGE function accepts another optional Number as input, specifying the increments between Numbers in the List.

#### Declaration

```javascript
RANGE(start, end, step) -> range
```

&#x20;

#### Parameters

**start** (required, type: _Number_) Any Number. In general, this Number will be the first item in the returned List.

**end** (required, type: _Number_) Any Number. This number designates when the returned List will end; no number past this one will be included in the List. Depending on the value of **step**, this number will not necessarily be included at the end of the returned List itself.

**step** (optional, type: _Number_, default: 1) The desired increment to increase each Number in the returned List by.

#### Return Values

**range** (type: List) The List of Numbers spanning from **start** to **end** by increasing each Number in the List in increments of **step**.

#### Examples

The following example returns a List spanning the numbers from 1 to 10. Note that the default value of **step** is 1, and so, as the list goes on, each Number is 1 more than the Number listed previous:

```javascript
RANGE(1, 10) -> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
```

The following example returns a List spanning the numbers from 1 to 10 in increments of 2. Note that 10 itself is not included in the returned List:

```javascript
RANGE(1, 10, 2) -> [1, 3, 5, 7, 9]
```

The following example attempts to return a list ranging from 10 to 1. However, the default value of **step** is positive 1, and there is no way to go from 10 to 1 by adding ones to the number ten. RANGE, therefore, returns a blank list:

```javascript
RANGE(10, 1) -> []
```

In order for RANGE to return a List ranging from 10 to 1 – a List where the numbers _decrease_ as the List goes on – a negative Number value must be specified for the value of **step**. The following example returns a list spanning from 10 to 1, where each number in the list decreases by 1:

```javascript
RANGE(10, 1, -1) -> [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
```
