Skip to content

Instantly share code, notes, and snippets.

@krishnabhargav
Created July 25, 2014 00:30
Show Gist options
  • Select an option

  • Save krishnabhargav/8e07a7ea4b5be6b789fa to your computer and use it in GitHub Desktop.

Select an option

Save krishnabhargav/8e07a7ea4b5be6b789fa to your computer and use it in GitHub Desktop.
def factorial(num : Int) : Int = {
if(num > 1) num * factorial (num-1) else num
}
factorial(5) ///will print 120
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment