directive

elif/1

Description

elif(Goal)

Supports embedded conditionals when performing conditional compilation. The code following the directive is compiled iff Goal is true. If Goal throws an error instead of either succeeding or failing, the error is reported by the compiler and compilation of the enclosing source file or entity is aborted. The goal is expanded when the directive occurs in a source file.

Warning

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 successfully compiled and loaded).

Template and modes

elif(@callable)

Examples

:- if(current_prolog_flag(double_quotes, codes)).

    ...

:- elif(current_prolog_flag(double_quotes, chars)).

    ...

:- elif(current_prolog_flag(double_quotes, atom)).

    ...

:- endif.

See also

else/0, endif/0, if/1