[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Re: Variables into MacPerl Ask



rdm@cfcl.com (Rich Morin) wrote:
>>        }
>>        if ($type le "ttro" and $type ge "ttro") {
>....
>>        }
>>        if ($type le "GIFf" and $type ge "GIFf") {
>....
>
>Some folks would complain about the fact that you are performing
>superfluous tests here.  That is, if a test succeeds, why test
>other possibilities that cannot succeed?  Thus, put a return at
>the end of each block:
>
>....
>>        }
>>        if ($type le "ttro" and $type ge "ttro") {
>....
>            return;
>>        }
>>        if ($type le "GIFf" and $type ge "GIFf") {
>....


I'd rather see "elsif" than a bunch of returns:


  if ($type eq "ttro") {
    ....
  } elsif ($type eq "GIFf") {
    ....
  } elsif ($type eq "JPEG") {
    ....


  -------------------                            -------------------
  Ken Williams                             Last Bastion of Euclidity
  ken@forum.swarthmore.edu                            The Math Forum



===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org