in reply to bloated 'if' formatting

I'd do any of:
if (condition && condition && condition) { ... } if (condition && condition && condition) { ... } if (condition && condition && condition) { ... }
I typically use the first if it's short and fits on one line. I choose between the latter two depending on the phase of the moon, or the number of times my cat purrs.

Sometimes, I write:

if (condition && condition && and_a_very_long_condition) { ... }
Perl --((8:>*

Replies are listed 'Best First'.
Re^2: bloated 'if' formatting
by Hue-Bond (Priest) on Oct 06, 2005 at 18:21 UTC

    I also used to use:

    if (condition && condition && condition) { code }

    But I didn't like the effect of conditions having the same indentation level as the subsequent code (since I also use 4 column indenting), making it difficult to discern the condition from the code, at least at a first sight. So from now on, I think I'll use the other construct:

    if (condition && condition && condition) { code }

    that was unknown to me :^).

    --
    David Serrano