QiTASC.com / intaQt Built-ins /
Ranges Built-ins
/ .. /
Ranges Built-ins

# Ranges Built-ins¶

Ranges Built-ins generate a list of inclusive ranges from two integer values. The range can either be consecutive numbers or incremented by a specified step size.

Note:

• Only integers are allowed, and they must be of the BigDecimal type.

• The numbers are all inclusive values.

Syntax

 `1` ``` := range(, , ) ```

Returns

The variable that holds the range's result.

Parameters

• begin - The beginning of the range and the first number in the iteration

• end - The end of the range

• The ranges are always inclusive, and the end number only isn't included if the last step exceeds the end value
• For example, with `range(0,99,2)`, the last number will be 98
• step (Optional) - The increment in the value of the iteration

• It can be negative
• Default is set to `1` when `begin` < `end` or `-1` when `begin` > `end`

Example

 ```1 2 3``` ```a := range(0,9) println(a.toString()) [0,1,2,3,4,5,6,7,8,9] ```

Example 1 - Iterate from 0 to 9

 ```1 2``` ```for i in range(0, 9) end ```

Example 2 - Iterate I from 10 to 1

 ```1 2``` ```for i in range(10, 1) end ```

Example 3 - `i` Is Always an Even Number [0, 2, 4, 6, 8]

 ```1 2``` ```for i in range(0, 9, 2) end ```

Example 4 - `i` Is Always an Even Number [0, -2, -4, -6, -8]

 ```1 2``` ```for i in range(0, -9, -2) end ```

Example 5 - Body Is Never Executed, This Range Yields the Empty List []

 ```1 2``` ```for i in range(0, -9, 2) end ```