fun fac n let acc 1 while n > 0 let acc (acc * n--) endwhile return acc endfun