Skip to content

Instantly share code, notes, and snippets.

@shigemk2

shigemk2/1-37.c

Created Apr 21, 2015
Embed
What would you like to do?
function(int n) {
if(n <= 1) return;
for (int i = 1 ; i <= 3; i++) {
printf("i: %d\n", i);
function(3/n);
}
}
main() {
function(2);
}
object one37 {
def function(n: Int): Int = {
for(i <- 1 to 3) {
n match {
case n if n <= 1 => 0
case n => {
function(3/n)
println(s"i: $i")
}
}
}
0
}
def main(args: Array[String]) {
function(3)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.