title: Operator |= for a boolean in C++
body: <p>I stumbled upon the following construction in C++:</p>
  
  <pre><code>bool result = false;
  for(int i = 0; i&lt;n; i++){
    result |= TryAndDoSomething(i);
  }
  </code></pre>
  
  <p>I supposed that this <code>|=</code> was a shortcut for the OR operator, and that <code>result</code> would equal <code>true</code> in the end if at least one of these calls to <code>TryAndDoSomething</code> had returned <code>true</code>.</p>
  
  <p>But now I am wondering if more than one call can actually return <code>true</code>. Indeed if we extend the operation as:</p>
  
  <pre><code>result = result || TryAndDoSomething(i);
  </code></pre>
  
  <p>Then the method will be called only if return evaluated to <code>false</code>, that is, if no other call before returned <code>true</code>. Thus after one call returning <code>true</code>, no other call will be done.</p>
  
  <p>Is this the correct interpretation?</p>