next up previous contents
Next: Code Layout Up: Comments Previous: Section Comments

End of Line Comments

The use of the % sign to indicate a comment is generally safer because the comment is terminated automatically by an end of line. Consequently, this form of comment is preferred.

There are two forms of usage: as a descriptor for a predicate and as comments on individual clauses and subgoals in a clause. As an illustration of comments on predicate definitions:

 

Now for the use of % for clauses and subgoals:
 
append([],L,L).				 		   % the base case

append([HL1],L2,[HL3]) :-

append(L1,L2,L3). % recurse on the first argument

Everything on the line after ``%'' will be ignored by Prolog.



Paul Brna
Mon May 24 20:14:48 BST 1999