title: Modulus in Prolog
body: <p>I am trying to use a conditional statement if N is even do something otherwise do something else.
  Here is some part of my code where I am doing this:</p>
  
  <pre><code>(N,Lines,1):-write(N),nl,
  (    mod(N,2) = 0 -&gt;
   write('Hello'),nl,write('Again Hello')
  
  ;
      foo(N,Lines)
  
  ).
  </code></pre>
  
  <p>But even if I give N=6 it goes into <code>foo(N,Lines)</code> i.e else part. It is not going into if part. Can someone please tell me where I'm wrong?</p>