Is it possible to init a variable in the while condition body for Kotlin?
<p>In the code below:</p>

<pre><code>    var verticesCount: Int // to read a vertices count for graph

    // Reading until we get a valid vertices count.
    while (!Assertions.checkEnoughVertices(
            verticesCount = consoleReader.readInt(null, Localization.getLocStr("type_int_vertices_count"))))
        // The case when we don't have enough vertices.
        println(String.format(Localization.getLocStr("no_enough_vertices_in_graph"),
                              Assertions.CONFIG_MIN_VERTICES_COUNT))

    val resultGraph = Graph(verticesCount)
</code></pre>

<p>we are getting next error on the last line:</p>

<pre><code>Error:(31, 33) Kotlin: Variable 'verticesCount' must be initialized
</code></pre>

<p><strong>Assertions.checkEnoughVertices</strong> accepts a safe type variable as an argument (verticesCount: Int), so it's impossible for verticesCount to be uninitialized or null here (and we're getting no corresponding errors on those lines). </p>

<p>What's going on on the last line when already initialized variable becomes uninitialized again?</p>