Skip to content

Instantly share code, notes, and snippets.

@ahmetb
Created November 24, 2010 21:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahmetb/714446 to your computer and use it in GitHub Desktop.
Save ahmetb/714446 to your computer and use it in GitHub Desktop.
factorial in scala
scala> def f(n:Int):Int = if (n<2) 1 else n*f(n-1)
f: (Int)Int
scala> f(5)
res2: Int = 120
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment