PreviousUpNext

12.14  If statements

“Strunk felt that the reader was in serious
  trouble most of the time, a man floundering
  in a swamp, and that it was the duty of anyone
  attempting to write English to drain the swamp
  quickly and get his man up on dry ground, or
  at least throw him a rope.”

                                                —
EB White

Thou shalt not wrap useless parentheses around entire if conditions.

The canonical if statement layouts are

    if   condition   then   action;   fi;

    if   condition   then   action;
                     else   action;   fi;


    if   condition
    then
         big expression;
    else
         big expression;
    fi;

    if   condition
    then
         statement;
         statement;
         ...
    fi;

    if   condition
    then
         statement;
         statement;
         ...
    else
         statement;
         statement;
         ...
    fi;

Use the most readable alternative.

Fine points:


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext