Factorial in Euphoria

Example for versions Euphoria v3.1.1, Euphoria v4

This example uses recursive factorial definition.

function factorial(integer n)
  atom result

  if n <= 1 then
    result =  1
  else
    result = n * factorial(n-1)
  end if

  return result
end function

for i = 0 to 16 do
 printf(1, "%d! = %d\n", {i, factorial(i)})
end for