How to edit, load and run Prolog programs?
teaches(liu, cs, 005).
teaches(liu, cs, 050).
teaches(krish, cs, 290).
teaches(krish, cs, 015).
Saved with a name: teaches.pl
The following message should pop up:
Welcome to SWI-Prolog (Multi-threaded, Version 5.2.13)
Copyright (c) 1990-2003 University of Amsterdam.
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.
Please visit http://www.swi-prolog.org for details.
For help, use ?- help(Topic). or ?- apropos(Word).
And also a ?- prompt, means ready to go
A “yes” should follow up, which says prolog successfully loaded the file and is ready to take queries.
?- teaches(X,cs, 005).
X = liu
?- teaches(krish, Dep, Course).
Dep = cs
Course = 290 ;
Dep = cs
Course = 15 ;
Send mail to
questions or comments about this web site.