Skip to content

Instantly share code, notes, and snippets.

@dgadiraju
Created May 7, 2017 01:53
Show Gist options
  • Save dgadiraju/3b4759ac35948afd74492534e5d4424d to your computer and use it in GitHub Desktop.
Save dgadiraju/3b4759ac35948afd74492534e5d4424d to your computer and use it in GitHub Desktop.
def fact(i: Int) = {
var res = 1
for(e <- i to 1 by -1)
res = res * e
res
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment