vendredi 24 février 2017

Ocaml syntax error in a simple if-then-else

I want to change some code written in C into Ocaml

Here is a C code

int a, b;
if(m > n)
{
    a = n;
    b = m;
}
else
{
    a = m;
    b = n;
}

and I tried to change it into Ocaml but somehow I got a syntax error at the second line.

let rec gcd m n =
 if m > n then begin let a = n in; let b = m in end
 else begin let a = m in; let b = n in end

What is the problem and how can I fix it?

Aucun commentaire:

Enregistrer un commentaire