A Tour of Morfa

Function declaration

Function declarations start with the keyword func followed by the function name, list of parameters in parentheses and the return type.

func gcd(a: int, b: int): int
   if (b == 0)
      return a;
   if (a > b)
      return gcd(a-b, b);
      return gcd(a, b-a);

Types of parameters must be specified but the return type may be omitted—in this case the compiler will try to infer it.