Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Spacing in conditionals, etc.

4 views
Skip to first unread message

scottdware

unread,
Mar 14, 2011, 9:29:45 AM3/14/11
to
So, I've seen quite a mixture of code using a space after say, for example...an "if-then-else" block:

if { [some command] } {
# do something
}

vs.

if {[some command]} {
# do something
}

Is it good practice to place that additional space after the opening bracket/ending bracket in a statement like above? I assume that its mostly personal preference? What is a better solution, do you think, if any?

Thanks, sorry if it's a noob question.

Arjen Markus

unread,
Mar 14, 2011, 9:37:17 AM3/14/11
to

I myself am fond of the first form - but then I like space. Yes, it is
mostly personal
preference.

Apart from that, I feel that the first form makes it harder to miss
the
square brackets.

Regards,

Arjen

scottdware

unread,
Mar 14, 2011, 9:43:26 AM3/14/11
to
Yeah, it is a little easier on the eyes, IMO. Thanks for the reply, Arjen!

Donald Arseneau

unread,
Mar 14, 2011, 2:35:21 PM3/14/11
to
scottdware <scott...@gmail.com> writes:

> if { [some command] } {
> vs.
> if {[some command]} {


>
> Is it good practice to place that additional space after the opening bracket/ending bracket in a statement like above? I assume that its mostly personal preference? What is a better solution, do you think, if any?

Mostly personal preference and esthetic appeal.
However there was a time when a performance bug hurt the
compact version but not the spaced verision... as I recall
vaguely.

--
Donald Arseneau as...@triumf.ca

0 new messages