Created
April 21, 2015 15:18
-
-
Save shigemk2/ec83180321d37293e1ae to your computer and use it in GitHub Desktop.
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
| 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); | |
| } |
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
| 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