Demo entry 3548871

example_1

   

Submitted by anonymous on Jan 19, 2016 at 20:11
Language: Scala. Code size: 301 Bytes.

eval("""
    |{
    |   def factorial(x: Int): Int = {
    |     x match {
    |       case 0 => 1
    |       case 1 => 1
    |       case _ => x * factorial(x - 1)
    |     }
    |   }
    |   val y = factorial(3)
    |   println(y)
    |   y
    |}
""".stripMargin.parse[Term]))    

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).