Files
openide/plugins/kotlin/code-insight/descriptions/resources-en/inspectionDescriptions/ConvertTwoComparisonsToRangeCheck.html
Nikita Bobko 8b91f1c7c0 Kotlin plugin inspection descriptions: 'A quick-fix' -> 'The quick-fix'
Review: https://jetbrains.team/p/ij/reviews/98339

It's a concrete quick-fix

GitOrigin-RevId: 3388021f0cde4cb49f8c447361c0d8b2fd08cafd
2022-12-01 13:43:09 +00:00

19 lines
523 B
HTML

<html>
<body>
Reports two consecutive comparisons that can be converted to a range check.
<p>Checking against a range makes code simpler by removing test subject duplication.</p>
<p><b>Example:</b></p>
<pre><code>
fun checkMonth(month: Int): Boolean {
return month >= 1 && month &lt;= 12
}
</code></pre>
<p>The quick-fix replaces the comparison-based check with a range one:</p>
<pre><code>
fun checkMonth(month: Int): Boolean {
return month in 1..12
}
</code></pre>
<!-- tooltip end -->
</body>
</html>