[Message Prev][Message
Next][Thread Prev][Thread Next][Message
Index][Thread Index]
Re: [OT] Coding style nazis
Nooo, not the coding wars! Wherever programmers gather, this subject comes
up, and the real answer is - use whatever style you're comfortable with,
but use it consistently.
(Personally I prefer style 2, with braces on lines of their own, but where
I work we don't enforce any style standard - which is nice.)
David P. - stuck at work, coding like a demon for a milestone
(hopefully BT won't send my post twice this time)
Calum Morrell <calum@xxxxxxx> wrote:
UKHA wrote:
> Ok,
>
> Totally OT, but there you go.
>
> I'm looking for some decent resources that will explain why my coding
style is "wrong", anyone have any?
>
> I'm referring to stuff like why:
>
> for (my $x=0;$x<@_;$x+=2) {
> somestuff;
> somestuff;
> somestuff;
> somestuff;
> somestuff;
> }
>
>
> is better than:
>
> for (my $x=0; $x < @_; $x+=2)
> {
> somestuff;
> somestuff;
> somestuff;
> somestuff;
> somestuff;
> }
They're both wrong ...
for (my $x=0;$x<@_;$x+=2) {
somestuff;
somestuff;
somestuff;
somestuff;
somestuff;
}
although the first brace could easily be on a line on it's own as well
.. it's just easier to read large code blocks as the end brace matches
with the start "for", so optically it makes sense. Program in
Python for
a while to get used to it.
--
Calum Morrell
www.drochaid.org
UKHA_D Main Index |
UKHA_D Thread Index |
UKHA_D Home |
Archives Home
|