title: Is there a more elegant syntax for these boolean expressions?
body: <p>I was just writing an improved linear version of a recursive Fibonacci algorithm, and realized that my boolean expressions look really bad and unreadable. Is there a <em>cleaner</em> way to do what I'm trying to do?</p>
  
  <pre><code>int fibonacci(int num) {
  
      if (num &lt;= 1)
          return num;
  
      // starts looking ugly here
  
      int a = intExists(num-1);
      int b = intExists(num-2);
  
      bool aAndB = (a != -1 &amp;&amp; b != -1);
      bool justA = (a != -1 &amp;&amp; b == -1);
      bool justB = (a == -1 &amp;&amp; b != -1);
  
      int number = 0;
  
      if (aAndB)
          number = (a + b);
      else if (justA)
          number = (a + fibonacci(num - 2));
      else if (justB)
          number = (fibonacci(num-1) + b);
      else
          number = (fibonacci(num - 1) + fibonacci(num - 2));
  
      map.push_back(Pair(num, number));
  
      return number;
  }
  </code></pre>
  
  <p>Thanks</p>