Skip to content

Instantly share code, notes, and snippets.

@ahmetb ahmetb/fact.scala
Created Nov 24, 2010

Embed
What would you like to do?
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
You can’t perform that action at this time.