next up previous contents
Next: Posing a goal Up: An Example Previous: Saving a file   Contents

Consulting a file

Now that you have created a file, you need to inform Prolog of its contents. You do this by consulting the file. There are two ways to do this.

First, use the mouse to select the SWI-Prolog window in which Prolog is running. Then, type either

|?- consult(family).


|?- [family].

Note: It is conventional to give Prolog source files the extension .pl. SWI-Prolog knows about this, so you do not need to give the full filename and extension when consulting it. In fact, if you do type consult( or [family]., you will receive an error message for your pains!

If your file contains no errors, you should receive a message telling you that the file has been consulted successfully. You are now in a position to get Prolog to do some work.

Steve Harlow 2001-11-12