Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

(zdog) Re: Logical expression style

by zdog (Priest)
on Jul 12, 2002 at 16:52 UTC ( #181341=note: print w/ replies, xml ) Need Help??


in reply to Logical expression style

My style is probably closest to your "operator goes at the beginning". I do stick the operators in front of the expressions, but I usually indent slightly more:

if (A [too, short, lets, add, something] && B [too, short, lets, add, something] && C [too, short, lets, add, something])

Why? Well, it's sorta like saying why one color is better than another (at least to me). For one, the extra indention that puts B and C below A helps clarify (again, "to me") that B and C are part of A's expression. Second, the &&'s sorta act like bullets listing the B and C expressions. :-) And finally, in my head, the &&'s apply more to B and C rather than A and B.

Maybe those aren't very good reasons, but I just like it like that, and in the same way: "Blue rules!" ;-)

Zenon Zabinski | zdog | zdog@perlmonk.org


Comment on (zdog) Re: Logical expression style
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://181341]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2015-07-07 07:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (87 votes), past polls