# no-reversed-range

Disallow constant ranges whose start exceeds their end

An ascending range with a constant start greater than its end cannot yield a value.
Instead, you MUST order the endpoints from lower to higher.

- Category: correctness
- Level: error
- Fix: none
- Scope: module

## Reported

```ds title="main.ds"
function values(): Range<int32> {
    return 10..0;
}
```

## Accepted

```ds title="main.ds"
function values(): Range<int32> {
    return 0..10;
}
```

## Prior art

- [Clippy · reversed_empty_ranges](https://rust-lang.github.io/rust-clippy/master/index.html#reversed_empty_ranges)

[language/linter/src/rules/correctness/no_reversed_range.rs:6](https://github.com/destack-sh/destack/blob/main/language/linter/src/rules/correctness/no_reversed_range.rs#L6)
