Matija wrote:
> I'm curious which of the two examples is more
> preferred or it depends
> entirely on someone style?
> ----------------
> $x = 1;
>
> #1)
> if ($x) { $x = 0 }
> #2)
> $x = 0 if $x;
> ----------------
I think it's a matter of style, but also one should
consider who will be maintaining this code in the
future and whether they will be familiar with Perl or
if they will have a more general CS background.
if ($x) { $x = 0 }
is definitely more traditional and easily recognizable
by non-Perl programmers.
$x = 0 if $x
reads more naturally for some (like me) and has a
nicer look (to me) because there are less brackets.
=====
Dave Hoover
"Twice blessed is help unlooked for." --Tolkien
http://www.redsquirreldesign.com/dave
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/