title: Avoid else condition in 'When' in kotlin
body: <p>As per documentation of <a href="https://kotlinlang.org/docs/reference/control-flow.html#when-expression" rel="noreferrer">When</a> in Kotlin, else is not mandatory if the compiler knows all the values are covered. This is very in case of emums or sealed class but how to do it in case of arrays for numbers 1 to 5 (startRating).</p>
  <pre><code>private fun starMapping(startRating: Int): String {
  
      return when (startRating) {
          1 -&gt; &quot;Perfect&quot;
          2 -&gt; &quot;Great&quot;
          3-&gt; &quot;Okay&quot;
          4-&gt; &quot;Bad&quot;
          5-&gt; &quot;Terrible&quot;
          // don't want to add else as I believe it is prone to errors.
      }
  }
  </code></pre>
  <p>Something similar to this</p>
  <pre><code>return when (AutoCompleteRowType.values()[viewType]) {
          AutoCompleteRowType.ITEM -&gt; ItemView(
                  LayoutInflater.from(parent.context).inflate(R.layout.item_venue_autocomplete_item_info, parent, false))
  
          AutoCompleteRowType.SECTION -&gt; SectionView(
                  LayoutInflater.from(parent.context).inflate(R.layout.item_venue_autocomplete_section, parent, false)
          )
      }
  </code></pre>