On Tue, Jun 26, 2001 at 06:05:15PM -0400, Gross, Stephan wrote:
> Why is this style
>  
> if ($x) {
>     do this;
>     do that;
> }

This style is also known as The One True Brace Style, popularized by
Kernighan & Ritchie (in _The C Programming Language_).  It's also popular
with other languages, such as Perl, Java, C++, etc.

> typically preferred over
>  
> if ($x)
> {
>    do this;
>    do that;
> }
>  
> I like the latter example because it's easier to cut and paste the braces
> and everything in between.  I also think it looks better.  But none of the
> top programmers ever seems to do this.
> Just wondering...

The "One True Brace Style" isn't universal.  Use whatever works best for
you and your group/team/project.  :-)

Z.

Reply via email to