Last active
September 17, 2017 04:12
-
-
Save kmizu/b2f2611bcbfbfbf3e1832c2a6490c419 to your computer and use it in GitHub Desktop.
Scalaにまつわるよくある誤解~returnの省略~ ref: http://qiita.com/kmizu/items/8be316b481d53806d28a
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 add(x: Int, y: Int): Int = { | |
x + y | |
} |
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 display[A](a: A): A = { | |
println(a) | |
a | |
} |
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 fact(n: Int): Int = { | |
if(n < 2) return 1 | |
n * fact(n - 1) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment