If statement in prolog
问题 Hello i have a problem with if statement. i have this final(C1-W1,C2-W2,C3-W3):- retractall(end_jug), asserta( end_jug(C1,W1) ), asserta( end_jug(C2,W2) ), asserta( end_jug(C3,W3) ). and this one katastasi(L) :- findall(X-W, jug(X,W), L0), sort(L0,L). How can i have this check????: if(jug(C1,W1) == end_jug(C1,W1) && jug(C2,W2) == end_jug(C2,W2) && jug(C3,W3) == end_jug(C3,W3)) write('Congrats'). Thanks in advance!! 回答1: Like this: is_final_state :- katastasi(S), writeln(S), S=[C1-W1,C2-W2,C3