Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs on RANGE_TO_UNTIL rule #1525

Merged
merged 1 commit into from
Sep 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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