progs/factT.scala
author Christian Urban <christian.urban@kcl.ac.uk>
Sat, 11 Mar 2023 22:42:09 +0000 (23 months ago)
changeset 464 73ced118f73d
parent 449 d67c5f7177a6
permissions -rw-r--r--
updated to scala 3
object FactT {

def factT(n: Int, acc: Int): Int =
  if (n == 0) acc else factT(n - 1, n * acc)

}