# Unterminated conditional compilation error?

**URL:** <https://swi-prolog.discourse.group/t/unterminated-conditional-compilation-error/785>\
**Category:** Help!\
**Created:** [June 10, 2019, 4:52pm UTC](https://swi-prolog.discourse.group/t/unterminated-conditional-compilation-error/785 "2019-06-10T16:52:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![prodog](https://avatars.discourse-cdn.com/v4/letter/p/57b2e6/32.png) [@prodog](https://swi-prolog.discourse.group/u/prodog)\
**Post date:** [June 10, 2019, 4:52pm UTC](https://swi-prolog.discourse.group/t/unterminated-conditional-compilation-error/785/1 "2019-06-10T16:52:48Z")

</div>

I’m using: SWI-Prolog version 8.0.2.

I’ve been staring at the code below for a long time now and I can’t for the life of me figure out why SWI-Prolog is complaining that the `else` section is unterminated, despite there clearly being an `endif` statement present. If I remove the entire `if/else/endif` block the error goes away.

Can someone see something that I’m just not seeing?

```prolog
:- if(pengine_self(_)).

% This predicate calls pengine_output if we are in a Pengines context, otherwise
% write() is called.
x_write(Str) :-
    % We are running in a Pengines instance, use pengine_out.
    pengine_output(Str).
x_nl :-
    % We are running in a Pengines instance, use pengine_out.
    pengine_output('\n').

:- else.

x_write(Str) :-
    % We are NOT running in a Pengines instance, use write.
    !,
    write(Str).
x_nl :-
    % We are NOT running in a Pengines instance, use nl.
    !,
    nl.

:- endif.

```

**UPDATE** : Nevermind, I completely exited the interpreter and reloaded `swipl` and the error disappeared. I’ll leave this post here in case someone else runs into the same problem, if no one objects to me doing that.

---

<div class="post-metadata">

**Author:** ![peter.ludemann](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/peter.ludemann/32/48_2.png) [@peter.ludemann](https://swi-prolog.discourse.group/u/peter.ludemann)\
**Post date:** [June 10, 2019, 7:48pm UTC](https://swi-prolog.discourse.group/t/unterminated-conditional-compilation-error/785/2 "2019-06-10T19:48:51Z")

</div>

Isn’t `pengine_self` a runtime predicate? If so, the if/else/endif directives won’t work with it … you should use regular runtime `( pengine_self(_) -> ... ; ... )`.

(I think)
