

We can now use % interactive mode to ask if it is true for different values: ?- magicNumber ( 7 ). Note that % predicate names must start with lower case letters. % This introduces magicNumber as a predicate and says that it is true % with parameter 7, 9, or 42, but no other parameter. % As an example, here is a definition of the simplest kind of predicate: % a fact. % A command (called a goal) tells Prolog to make that state of the world % come true, if possible. % A subprogram (called a predicate) represents a state of the world. % Prolog is based on the ideal of logic programming. Different Prologs may behave % differently. % A bunch of errors and warnings will trigger when you load this file % due to the examples which are supposed to fail - they can be safely % ignored. % Lines that begin with ?- can be typed in interactive mode. % This code must be loaded from a file to work as intended. % Prolog treats code entered in interactive mode differently % to code entered in a file and loaded ("consulted").
