I need an if-then-else to add either A or B to C. I need to add the largest of A and B and put the result in total. I have tried with something like below but it doesnt work.
How about:
[tt]
max(A,A,B):- A >= B.
max(B,A,B):- B >= A.
addmax(Total,And,Or1,Or2):-
max(M,Or1,Or2),
Total is And + M.
[/tt]
Then:
[tt] addmax(T,123,456,789).[/tt]
will give:
[tt]T = 912[/tt]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.