How is speed affected in the following scenarios:

1) Using a number of if statements
i.e.
while ($foo) {
  do_1() if ($condition_1);
  do_2() if ($condition_2);
  # ...
}
2) Using a series of if elsifs
i.e.
while ($foo) {
  if ($condition_1) {
    do_1();
  }
  elsif ($condition_2) { 
  do_2();
  }
  # ...
}
3) using a series of if elsifs and calling next:
i.e.
while ($foo) {
  if ($condition_1) {
    do_1();
    next;
  }
  elsif ($condition_2) { 
  do_2();
    next;
  }
  # ...
}


For readability, I prefer 1 over 2.  But I figured 2 would be faster
then 1.  For readability I prefer 2 over 3, but I figure the lasts would
be implied in #2.  Is this the case?  Or should I bite the bullet and
use 3?

Thanks in advance,

Dan


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to