On Sat, 2009-03-07 at 06:23 -0800, Michael A. Peters wrote: > 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.) > It's easy to check in that example, but imagine a case in the switch that spans many screens worth of content, with many multiple levels of indentation. It soon gets impossible to check with a quick glance. Yes, a good IDE does make this a non-issue,... but real coders use a standard text editor don't they? ;) Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php