Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def safeDiv[A: Numeric](a:Option[A], b:Option[A]):Option[Fractional] = (a,b) match {
- case (None,_) | (_,Some(0)) | (_,None) => None
- case (Some(x),Some(y)) => Some(x / y)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement