Thread: formatting
View Single Post
Old 03-31-2003, 11:14 PM   #22 (permalink)
abc123
bloomberg
 
abc123's Avatar
 
Join Date: Jun 2002
Location: bloomberg
Posts: 263
abc123 is on a distinguished road
Send a message via AIM to abc123 Send a message via Yahoo to abc123
Quote:
Originally posted by Epsilon
I recently finished up a Web application for a client that was just under 7000 lines of code. Out of curiosity, I wrote a little script to count the number of times I could have gotten away with leaving the braces off a statement.

The total "space" savings would amount to less than a kilobyte. So I guess if I was really anal about the size of my script I could reduce it from 269K to 268K.

Nah, I think I'll leave the braces in.

JJoSA made a good point that it can make debugging a nightmare.
no no, the trick is to reduce all your "if" statements so that they can fit in one statement

Code:
if(a){
  doThis();
  doThat();
  doSomething();
}

// becomes:
if(a)
  doThis();
if(a)
 doThat();
if(a)
 doSomething();
seriously tho, i use the no-bracket if statement all the time. I just wish I could write methods that way
__________________
-- bloomberg.
abc123 is offline   Reply With Quote