[thelist] javascript debug (easy)

Matt Warden mwarden at gmail.com
Sun Jun 5 20:38:33 CDT 2005


Jeff,

On 6/5/05, Jeff Howden <jeff at jeffhowden.com> wrote:
> Curly braces are only required when there is more than one statement within
> an if/else block.  They are therefore needed for the if() block above, but
> not the else block.

True. Just a note, though, that almost all published coding standards
frown upon conditionals that omit braces when they are not required.
The main reason for this is that omitting braces increases the
likelihood of bugs cropping up if someone were to add another line to
the condition's execution block. e.g.:

if (foo)
    bar();
else
    foobar();

edited to:

if (foo)
    bar();
else
    foobar();
    barfoo();


Just a warning, in case the OP decides to make a habit of omitting
braces where possible.

-- 
Matt Warden
Miami University
Oxford, OH, USA
http://mattwarden.com


This email proudly and graciously contributes to entropy.


More information about the thelist mailing list