title: Recursive Function with If-Else Statements in Prolog
body: <p>I'm trying to write a recursive function in prolog that computes <code>R = (2*X + Y)^N</code> without using the exponent operator. I've written a recursive function with if-else statements and I get the error: <code>) or operator expected</code>. It looks to me like I have the syntax correct, but I must be missing something. The code is below.</p>
  
  <pre><code>expbar(R, X, Y, N) :-
      (X =:= Y =:= N =:= 0 -&gt; 
          write("No two variables can equal 0 at the same time.");
          (N =:= 0 -&gt;
              R is 2 * X + Y;
              R is (2 * X + Y) * expbar(R, X, Y, N-1)
          )
      ).
  </code></pre>