Created
May 29, 2020 07:29
-
-
Save vigneshwaranr/7c5580480cddc7de1a53102daef09081 to your computer and use it in GitHub Desktop.
9e8a12f2112b / MaybeDivideable / divide1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def divide1(a: Int, b: Int): MaybeDivideable = { | |
MaybeDivideable(a) match { | |
case UnDivideable => | |
UnDivideable | |
case Divideable(x) => | |
MaybeDivideable(b) match { | |
case UnDivideable => | |
UnDivideable | |
case Divideable(y) => | |
MaybeDivideable(x / y) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment