title: Kotlin 'when' statement vs Java 'switch'
body: <p>Pattern matching in Kotlin is nice and the fact it does not execute the next pattern match is good in 90% of use cases.</p>
  <p>In Android, when database is updated, we use Java switch property to go on next case if we do not put a break to have code looking like that:</p>
  <pre><code>switch (oldVersion) {
      case 1: upgradeFromV1();
      case 2: upgradeFromV2(); 
      case 3: upgradeFromV3();
  }
  </code></pre>
  <p>So if someone has an app with version 1 of the DB and missed the app version with DB v2, he will get all the needed upgrade code executed.</p>
  <p>Converted to Kotlin, we get a mess like:</p>
  <pre><code>when (oldVersion) {
      1 -&gt; {
          upgradeFromV1()
          upgradeFromV2()
          upgradeFromV3()
      }
      2 -&gt; {
          upgradeFromV2()
          upgradeFromV3()
      }
      3 -&gt; {
          upgradeFromV3()
      }
  }
  </code></pre>
  <p>Here we have only 3 versions, imagine when DB reaches version 19.</p>
  <p>Anyway to makes when acting in the same way then switch? I tried to continue without luck.</p>