|
|
| laziness, impatience, and hubris | |
| PerlMonks |
(jeffa) 2Re: (Ovid - Why I love nested If-Else blocks)by jeffa (Chancellor) |
| on Jan 04, 2002 at 03:05 UTC ( #136139=note: print w/ replies, xml ) | Need Help?? |
|
You have a point and i do agree, but what happens when you scale your example up? That's what i am talking about here. Consider this: Get's hairy quick. At that point, i would definetaly try a dispatch table with sub references. Now, to _really_ go out on a limb, how about a goto as a replacement for your first example, since you are only concerned with calling the subs if one condition is true: Notice i didn't get rid of the outer if, i just seperated it from the inner if. Even though i use a goto, it looks more readable to me, simply because the indention level. Well, it looks more readable as long as i don't have to scan more than 10 lines to find where the goto is going! Besides, if this were inside a sub, i could replace the goto with return. BUT ... I do agree that your first example is more readable than your second, and is much better form than my goto solution. Did i just use a goto?!? jeffa L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR F--F--F--F--F--F--F--F-- (the triplet paradiddle)
In Section
Meditations
|
|
||||||||||||||||||||||||||||||||||