Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: A new idiom -or- I Hate Unless

by ambrus (Abbot)
on Aug 23, 2004 at 08:44 UTC ( [id://385026]=note: print w/replies, xml ) Need Help??


in reply to A new idiom -or- I Hate Unless

About how I use conditionals?

In perl I mostly use and and or for conditionals much more often than if and unless.

I never use prefix unless. I very rarely use postfix unless, only in cases when the condition almost always holds, like print ", " unless $index==$length-1;

I use prefix if for conditionals that have both a then and an else (or elsif) branch. I sometimes use prefix if for other conditionals randomly, especially when there is no action done in the condition. I sometimes use postfix if in similar cases, when the condition is not very important.

But for most conditionals, I just use and, or, or with multiple statements and do {, or do {. That is good because it places emphasis on the condition.

This is only my coding style in perl, it's of course different in other languages as their conditional constructs are different too.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-04-24 08:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found