This repository has been archived on 2025-09-23. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
2025LogProg-project-GhentPr.../examples/basics/unification.pl
2025-03-30 21:56:24 +02:00

22 lines
440 B
Prolog

grade(alice, a).
grade(bob, b).
grade(carol, a).
grade(dave, c).
got_an_a(Student) :-
grade(Student, Grade),
Grade = a.
did_not_get_an_a(Student) :-
grade(Student, Grade),
Grade \= a.
:- initialization(main).
main :-
write("While "),
got_an_a(X),
write(X), write(" got an A, "), fail;
write("but "),
did_not_get_an_a(Y),
write(Y), write(" did not get an A, "), fail; write("unfortunately."), nl.