In scala, how do I define addition over two Option arguments? Just to be specific, let\'s say they\'re wrappers for Int types (I\'m actually working with maps of do
Int
If they both default to 0 you don't need pattern matching:
def addOpt(a:Option[Int], b:Option[Int]) = { a.getOrElse(0) + b.getOrElse(0) }