diff --git a/examples/basics/password.pl b/examples/basics/password.pl new file mode 100644 index 0000000..7322247 --- /dev/null +++ b/examples/basics/password.pl @@ -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). diff --git a/examples/basics/repeat.pl b/examples/basics/repeat.pl new file mode 100644 index 0000000..35efa9b --- /dev/null +++ b/examples/basics/repeat.pl @@ -0,0 +1,2 @@ +repeat. +repeat :- repeat. \ No newline at end of file