|There's more than one way to do things|
Re: anonymous code blocksby Codon (Friar)
|on Sep 15, 2005 at 16:40 UTC||Need Help??|
Let me make one suggestion that may seem obvious to someone that has not been looking at this code before (You know that phenomenon where you look at the same block of code for hours trying to find the bug and then finally go ask someone to help you out and they point out the obvious error before you finish explaining the problem?). If you have an if ( ! some_test() ), it is generally more readable to say unless ( some_test() ). So using this logic
which is really
because any non-zero value (undef evaluates to 0 in this context) is TRUE. Using the same aurgument against unless ( ! some_test() ) as we did against if ( ! some_test() ), we then get
It's nitpicking, to be sure, but minor changes can have major benefit for anyone that has to maintain the code later, even the original author.
Sr. Software Engineer, DAS Lead