mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
Review: https://jetbrains.team/p/ij/reviews/98339 It's a concrete quick-fix GitOrigin-RevId: 3388021f0cde4cb49f8c447361c0d8b2fd08cafd
24 lines
865 B
HTML
24 lines
865 B
HTML
<html>
|
|
<body>
|
|
Reports local variables declared with the <code>var</code> keyword that are never modified.
|
|
<p>Kotlin encourages to declare practically immutable variables using the <code>val</code> keyword, ensuring that their value will never change.</p>
|
|
<p><b>Example:</b></p>
|
|
<pre><code>
|
|
fun example() {
|
|
var primeNumbers = listOf(1, 2, 3, 5, 7, 11, 13)
|
|
var fibonacciNumbers = listOf(1, 1, 2, 3, 5, 8, 13)
|
|
print("Same numbers: " + primeNumbers.intersect(fibonacciNumbers))
|
|
}
|
|
</code></pre>
|
|
<p>The quick-fix replaces the <code>var</code> keyword with <code>val</code>:</p>
|
|
<pre><code>
|
|
fun example() {
|
|
val primeNumbers = listOf(1, 2, 3, 5, 7, 11, 13)
|
|
val fibonacciNumbers = listOf(1, 1, 2, 3, 5, 8, 13)
|
|
print("Same numbers: " + primeNumbers.intersect(fibonacciNumbers))
|
|
}
|
|
</code></pre>
|
|
<!-- tooltip end -->
|
|
</body>
|
|
</html>
|