title: How to indent long conditionals for 'if' statements?
body: <p>My question relates to <a href="https://stackoverflow.com/questions/322034/if-statement-formatting-best-practise-whats-your-style">this previous question</a>, but the solutions offered don't address the problem I have outlined below. After a google search I haven't found any code style guidelines that address the specific problem of long conditionals in an if statement like this.</p>
  
  <pre><code>if( isNull(value1) ||
      isToLong(value1) ||
      hasBadFormat(valule1)){
      doSomething();
  }else{
      doSomethingElse();
  }
  </code></pre>
  
  <p>OR:</p>
  
  <pre><code>if( isNull(value1) || isToLong(value1) || hasBadFormat(valule1) ){
      doSomething();
  }else{
      doSomethingElse();
  }
  </code></pre>
  
  <p>The problem I have with these two styles is it makes it hard for my eye to find the code in the true block and separate it from the conditionals, or it is too difficult for the eye to determine the correct next line after a long conditional on a single line, especially if the if statement is already indented a few tabs inside a function or other if statements. </p>
  
  <p>Would it be preferable to do something like this:</p>
  
  <pre><code>if(     isNull(value1) ||
          isToLong(value1) ||
          hasBadFormat(valule1)){
      doSomething();
  }else{
      doSomethingElse();
  }
  </code></pre>
  
  <p>or would this style be better to indent each new condition in either of these ways:</p>
  
  <pre><code>if( isNull(value1) ||
          isToLong(value1) ||
              hasBadFormat(valule1)){
      doSomething();
  }else{
      doSomethingElse();
  }
  
  if( isNull(value1) 
          || isToLong(value1) 
              || hasBadFormat(valule1) ){
      doSomething();
  }else{
      doSomethingElse();
  }
  </code></pre>
  
  <p>Does anyone have a coding style guideline (maybe a company coding style policy) that addresses this issue in a different or better way than I've proposed? Which one is preferable and can you find any cons or pros to the solutions I've mentioned?</p>