Skip to content

Instantly share code, notes, and snippets.

@shigemk2
Created April 21, 2015 15:18
Show Gist options
  • Select an option

  • Save shigemk2/ec83180321d37293e1ae to your computer and use it in GitHub Desktop.

Select an option

Save shigemk2/ec83180321d37293e1ae to your computer and use it in GitHub Desktop.
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