Skip to content

Commit

Permalink
Add docs on RANGE_TO_UNTIL rule (#1525)
Browse files Browse the repository at this point in the history
### What's done:
* Add docs
  • Loading branch information
petertrr authored Sep 14, 2022
1 parent 1756fc3 commit 9d7a8d3
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions info/guide/guide-chapter-3.md
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,24 @@ if (condition1 && condition2 && condition1) {
}
```

<!-- =============================================================================== -->
### <a name="c3.17"></a> 3.17 Ranges
This section describes guidelines for working with ranges.

#### <a name="r3.17.1"></a> 3.17.1
When creating a range with excluded upper boundary, instead of using range function with included upper boundary (`rangeTo` or `..`)
it's preferred to use a range function with excluded upper boundary (`until`).
Invalid example:
```kotlin
0..(a-1)
```
Valid example:
```kotlin
0 until a
```

Instead of `rangeTo` function it's preferred to use `..` operator.

<!-- =============================================================================== -->
### <a name="c3.18"></a> 3.18 Logging
This section describes the general rules of logging.
Expand Down

0 comments on commit 9d7a8d3

Please sign in to comment.