Little Girl
Little Girl

Reputation: 27

how to write multiple conditions in if statement in cpn ml?

I'm writing a cpn ml language code and I'm almost a beginner. I wanted to know how can I write 2 or several conditions in if statement? I mean I want to "and" several condition so that all of them should be correct simultaneously. Here is the code. Can I separate conditions using ; as a solution?

fun EvalD(Xw,Yw,Xb,Yb) = if Xw=8 then false
else if (Xw=7;Yw=1;Xb=8;Yb=1) then false
else if (Xw=7;Yw=2;Xb=8;Yb=2) then false
else true;

Upvotes: 1

Views: 987

Answers (1)

Gyrotank
Gyrotank

Reputation: 153

In CPN ML there are keywords 'andalso' and 'orelse' for this purpose.

Upvotes: 0

Related Questions