title: Pattern matching vs if-else
body: <p>I'm novice in Scala. Recently I was writing a hobby app and caught myself trying to use pattern matching instead of if-else in many cases.</p>
  
  <pre><code>user.password == enteredPassword match {
    case true =&gt; println("User is authenticated")
    case false =&gt; println("Entered password is invalid")
  }
  </code></pre>
  
  <p>instead of</p>
  
  <pre><code>if(user.password == enteredPassword)
    println("User is authenticated")
  else
    println("Entered password is invalid")
  </code></pre>
  
  <p>Are these approaches equal? Is one of them more preferrable than another for some reason?</p>