fun factorial (n:int): int = if n > 0 then n * factorial(n-1) else 1 // end of [factorial]