Created
May 18, 2014 09:51
-
-
Save adilakhter/37eacb1cf398af489240 to your computer and use it in GitHub Desktop.
This file contains 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 odd1(n: Int): Boolean= { | |
if (n==0) false | |
else even1(n-1) | |
} | |
def even1(n: Int): Boolean = { | |
if (n==0) true | |
else odd1(n-1) | |
} | |
// output from scala repl | |
> even (3) => 3 2 1 0 => false | |
> even(4) => 4 3 2 1 0 => true | |
> odd(3) => 3 2 1 0 => true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment