Skip to content

Instantly share code, notes, and snippets.

@kmizu
Last active September 17, 2017 04:12
Show Gist options
  • Save kmizu/b2f2611bcbfbfbf3e1832c2a6490c419 to your computer and use it in GitHub Desktop.
Save kmizu/b2f2611bcbfbfbf3e1832c2a6490c419 to your computer and use it in GitHub Desktop.
Scalaにまつわるよくある誤解~returnの省略~ ref: http://qiita.com/kmizu/items/8be316b481d53806d28a
def add(x: Int, y: Int): Int = {
x + y
}
def display[A](a: A): A = {
println(a)
a
}
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