title: Looking for a neat functional way of carrying out this return
body: <p>Is there a neat functional way of carrying out this return without first assigning the value to the variable?</p>
  
  <p>Note: The first get is guaranteed of returning a valuable from the map and hence the "!!".
  The second get is not guaranteed and can thus return null.</p>
  
  <p>Thank you</p>
  
  <pre><code>fun isHidden(digitsChosen: String, digitNext: Char): Boolean {
      val middlePosition = positionsHidden.get(digitsChosen.last())!!.get(digitNext)
      return middlePosition != null &amp;&amp; digitsChosen.dropLast(1).contains(middlePosition).not()
  }
  </code></pre>