RE: [code-review] WebService::Validator::HTML::W3C

"Hodges, Paul" <Paul.Hodges-zv7RHi0Am8a1Z/[email protected]> Fri, 14 Nov 2003 13:06:50 -0600
Newsgroups gmane.comp.lang.perl.code-review-ladder
Message-ID <9C375DDD9B669243A2D78FCD607E894003E4FCFB@bremo-jg>
> From: Richard Clamp [mailto:richardc-PThgL6HeIXdH4x6Dk/[email protected]]
> Every time I see code like this:
> 
>  if (cond) {
>     # if code
>     return $thing;
>  }
>  else {
>     # else code
>  }
> 
> I get a ringing bell that says "hey, the programmer doesn't understand
> what the flow of control is here", and I find that some other shoe
> drops some time soon after.
> 
> A more pleasing form (for me) is this:
> 
>  if (cond) {
>     # if code
>     return $thing;
>  }
>  # else code
> 
> As at least expressed that way it seems that you know what return does
> for you.

I prefer the more concise

  return if cond;
  # other stuff ....

Same principle, though.


*****
"The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential, proprietary, and/or
privileged material.  Any review, retransmission, dissemination or other use
of, or taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited.  If you received
this in error, please contact the sender and delete the material from all
computers.61"