In c language i have something like :
if(cond1) {} else if(cond2) {} else {}
how is this possible in Prolog?
if_then_else(Condition,Then,Else) :- Condition, !, Then. if_then_else(Condition,Then,Else) :- Else.
For example:
max(X,Y,Max) :- if_then_else(X>Y,Max=X,Max=Y). ?- max(4,7,A). A = 7 ?- max(8,2,A). A = 8