2 ms·
How 'bout this: /// Compute the highest-common-factor of two integers let rec hcf a b = // notice: 2 parameters separated by spaces
by shawndumas 15y ago
How 'bout this:
/// Compute the highest-common-factor of two integers
let rec hcf a b = // notice: 2 parameters separated by spaces
if a=0 then b
elif a<b then hcf a (b-a) // elif = else if
else hcf (a-b) b
// note: function arguments are usually space separated
// note: 'let rec' defines a recursive function