Skip to main content

Define a Range

A range represents a sequence of numbers or values between two endpoints. In Decipad, you can work with ranges in various ways.

Creating a Range

You can declare a range by using the range(start .. end) syntax, where start and end represent the starting and ending points of the range:

Alternatively, you can use the range(start through end) or range(start to end) syntax:

Checking if a Number is within a Range

You can determine whether a specific number is within a range using the contains keyword:

Note that a range includes every number between the start and end points, so the following statement is also true:

Units in Ranges

A range can have a unit, similar to a single number. For example:

This indicates a range of quantities measured in oranges.

Ranges of Dates

You can also have ranges of dates by specifying the start and end dates:

This represents a range of dates from January 2022 to June 2022.