break or return from when expressions : <p>What I would like to do:</p>

<pre><code>when(transaction.state) {
    Transaction.Type.EXPIRED,
    //about 10 more types
    Transaction.Type.BLOCKED -&gt; {
        if (transaction.type == Transaction.Type.BLOCKED &amp;&amp; transaction.closeAnyway) {
            close(transaction)
            break //close if type is blocked and has 'closeAnyway' flag
        }
        //common logic
    }
    //other types
}
</code></pre>

<p>I cannot write <code>break</code>:</p>

<blockquote>
  <p>'break' and 'continue' are not allowed in 'when' statements. Consider using labels to continue/break from the outer loop.</p>
</blockquote>

<p>Is it a way to <code>return/break</code> from <code>when</code> statements? Or what is the best way to solve it?</p>
