title: Scala case match default value
body: <p>How can I get the default value in match case?</p>
  
  <pre><code>//Just an example, this value is usually not known
  val something: String = "value"
  
  something match {
      case "val" =&gt; "default"
      case _ =&gt; smth(_) //need to reference the value here - doesn't work
  }
  </code></pre>
  
  <p><strong>UPDATE:</strong> I see that my issue was not really understood, which is why I'm showing an example which is closer to the real thing I'm working on:</p>
  
  <pre><code>val db =    current.configuration.getList("instance").get.unwrapped()
              .map(f =&gt; f.asInstanceOf[java.util.HashMap[String, String]].toMap)
              .find(el =&gt; el("url").contains(referer))
              .getOrElse(Map("config" -&gt; ""))
              .get("config").get match {
                  case "" =&gt; current.configuration.getString("database").getOrElse("defaultDatabase")
                  case _  =&gt; doSomethingWithDefault(_)
              }
  </code></pre>