| Never use style 3
Just becase you're allowed to leave off the braces, doesn't mean you should.
It's a bad habit, and will cause you endless headaches when you're trying to figure out why something is working, only to realize that a line of code was executing because it wasn't wrapped in an if statement as thought.
You lose nothing by adding braces, and you gain ease of reading and ease of maintainence
Just Friday I spent hours debugging a piece of code, and one of the main problems was exactly this... a coworker left braces off. Combine that with poor (IE no) indentation in the script and it was damn near impossible to stop
Trust me, I've been doing this 20+ years. Don'e leave the braces off |