Ankit Shubham
Ankit Shubham

Reputation: 3629

Multiple conditions inside single 'if' in SML

How can multiple conditions be specified under single if? For example, consider the following java code snippet:

if(a==1 && a>b){
    //statements ;
}

How can above code be written in sml? I know that I can achieve the goal by using two if's but still if there is a method to specify in the way I want, then it will be smooth.

Upvotes: 1

Views: 466

Answers (1)

Ionuț G. Stan
Ionuț G. Stan

Reputation: 179209

SML's equivalent of && is andalso. For || there is orelse:

if a = 1 andalso a > b
then (* ... *)
else (* ... *)

Upvotes: 5

Related Questions