Factorial in Boo

Example for versions boo 0.8.2

This example uses recursive factorial definition. The function factorial is called recursively, so it needs an explicit declaration of its return type.

def factorial(n as long) as long:
    if n == 0:
        return 1
    else:    
        return n * factorial(n - 1)

for n in range(0, 17):
	print("${n}! = ${factorial(n)}")