lundi 28 septembre 2015

Make If statement with OR || and && checks

How may I make something like this in prolog:

if(A > -1 && A > 0){
   //DoSomething
}
else{
   //DoAnotherThing
}

Tried this:

positive([], []). %Tudo Vazio
positive([H1|T1], [H2|T2]) :- H1 > -1, H1 > 0 ->  H2 = H1, positivos(T1, T2).

Aucun commentaire:

Enregistrer un commentaire