if/1

Description

if(Goal)

Starts conditional compilation. The code following the directive is compiled iff Goal is true. The goal is subjected to goal expansion when the directive occurs in a source file.

Conditional compilation goals cannot depend on predicate definitions contained in the same source file that contains the conditional compilation directives (as those predicates only become available after the file is fully compiled and loaded).

Template and modes

if(@callable)

Examples

:- if(\+ predicate_property(length(_,_), built_in)).

    length(List, Length) :-
        ...

:- endif.

See also

elif/1, else/0, endif/0