Ashley Sheridan wrote:



I'm more a fan of lining up opening and closing brackets so they are at
the same indent level. It prevents one of the most popular errors caused
by omitting a bracket, brace or other in the wrong place. A few extra
line breaks in the code are not going to make a noticeable impact on the
file size of the script!

It's fairly easy to check for missing } with my method as well

statementA {
   statementa1
   statementa2
   statementa3
statementB {
   statementb1
   statementb2
   }


You can see the missing bracket for statementA by seeing that statementB doesn't have one above it.

I also generally create my } as soon as I create the { so I can comment the } identifying what it closes.

I don't always comment it, but when I don't there are times I did when trying to track down a logic issue in nested loops.

But - how to indent - if it's your project, whatever floats your boat, if it's a group project, you conform to the group specification for indenting (almost nothing is worse than several different indentation methods in a source file edited by multiple people - especially mixing real tabs and spaces, unix line breaks and dos line breaks.)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to