lundi 17 octobre 2016

Conditionals in ML

I am beginning to learn ML and we went over this piece of code in lecture:

val x = 1;
if hd [1, 2, 3] = x then x = x + 1 else x = x - 1;

Does this statement return false because the head of [1, 2, 3] is equal to 1, so it goes into the then part and compares 1 to 1 + 1?

Aucun commentaire:

Enregistrer un commentaire