|
Posted by Curtis on 01/04/06 00:30
Sean <oreilly.sean@gmail.com> wrote in message
news:1136292360.253201.225230@g49g2000cwa.googlegroups.com..
..
>
> > Nothing is wrong with it :) In fact, that'd be preferred
:)
>
> This is the preferred way for most to write a control
structure.
>
> if (condition) {
> statement
> } else {
> statement
> }
>
> This is done to distinguish a control structure from a
function call
> which should be written like.
>
> public foo ()
> {
> statement
> }
To my eyes, the "if" or "foreach" or "while" are sufficient
to create the distinction. (That and the fact that my editor
makes them a different color.)
Since the opening and closing braces must be
*programmatically* symmetrical, though, it makes sense to me
that they might well be *visually* symmetrical in either
case.
Obviously, though, there are no absolutes. That's why it's
called "style."
It's not much different from punctuation when writing prose.
Americans put the period inside the quotes where I wrote
"style." above. In the UK they would write that as "style".
When I first encountered this, it looked quite strange, but
clearly it's simply because I'm used to the other.
Where we put the braces may be somewhat less arbitrary if
our goal is to achieve visual cues for logical symmetry, but
people do manage to get along without it. A small matter in
the overall scheme of things, of course, and taste/custom
will out.
--
Curtis
Visit We the Thinking
www.wethethinking.com
An online magazine/forum
devoted to philosophical
thought.
>
[Back to original message]
|