?- (between(1,2,X) ; X = a). X = 1 ; X = 2 ; X = a.
It is strongly advised to always use parenthesis around
disjunctions. Conjunctions inside a disjunction should not use
parenthesis. Traditionally the
is placed at
the start of the line rather than at the end because a ;
at the end of a line is easily overlooked. Below is an example of the
preferred style used in SWI-Prolog.74Some
users prefer a newline after the ;
.
;
p :- a, ( b, c ; d ).
Although ;/2 is a control structure that is normally handled by the compiler, SWI-Prolog implements ;/2 as a true predicate to support call/2 and friends as well as to allow for querying predicate properties, for example to support code analysis.