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/scratchpad.pl
2025-05-01 17:13:35 +02:00

23 lines
472 B
Prolog

% choice(X) :- X = 1, !; X = 2.
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.