mercredi 3 mars 2021

Prolog - If AND Or Conditional

I am new in prolog. I want to write the equivalent pseudo-function in prolog:

if((d == 'A' || d == 'Z') && s > 20)
    return 'Yes';
else
   return 'No';

I have tried to write similar code but failed. I could not able to combine the "and" "or" operations.

decide(D, S, R):-
    ((D == 'A' ; D == 'Z'))  -> R=yes, R=no.

Aucun commentaire:

Enregistrer un commentaire