I am new to scala. I was writing a pattern matching as below:
val capitals = Map("France" -> "Paris", "Japan" -> "Tokyo")
show(capitals.get("test"))
def show(x: Option[String]) = x match {
case Some(s) | None => s
}
I am getting error:
Error: illegal variable in pattern alternative
case Some(s) | None => s
^
I am trying to see how can I achieve or condition like I have in if statement in java
if (str == null || str.isEmpty())
Can you help rewrite the code or point out the mistake?
Question: How do I mention or condition in a case pattern matching?