Add password example

This commit is contained in:
Tibo De Peuter 2025-05-18 15:45:13 +02:00
parent 83f65bd683
commit 50b4d192f3
Signed by: tdpeuter
GPG key ID: 38297DE43F75FFE2
2 changed files with 21 additions and 0 deletions

View file

@ -0,0 +1,19 @@
login :-
getdata(_, _),
writeln('Welcome!').
login :-
repeat,
writeln('Sorry, you are not permitted.'),
getdata(_, _),
writeln('Welcome').
getdata(Name, Password) :-
write('Username: '),
read(Name),
write('Password: '),
read(Password),
user(Name, Password).
user(john, john1).
user(jimmy, jimmy1).
user(mary, mary1).