I have:
 x match { 
  case a: SomeType => doSomething()
  case _ => doSomethingElse()
 }
Is there a way to check that 'a' is NOT of a given type?
like so:
x match { 
  case !(a: SomeType) => doSomething()
  case _ => doSomethingElse()
}
Edit: I agree the question may not be very clear but my interest was mostly the logical not and it has been answered.
Something like this:
x match { 
  case a: if !a.isInstanceOf[MyFirst] => doSomething()
  case b: MySecond => doSomething()
  case _ => doSomethingElse()
}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With