Hmmm, apparently, the list dismisses email that is sent from a smtp server 
other than the one for
which the email address would apparently belong to.

Onward (finally)

Jennifer Charrey wrote:
> c) The second function does extra work by doing up to two extra mods
> when the number is not even. If it's an integer and it's not even, it's
> odd. No need to do two more operations, allow more pathways for bugs
> (what if you'd forgotten about the -1 case?), make the code less
> readable, etc.

Ohhh, extra work!
They missed the extra else, don't forget to cover this case.
Also, added commas for clarity in output.

function evenOrOdd ($number) {
  if (is_numeric($number)) {
    if (($number % 2) == 0) {
      echo 'Your number, ' . $number . ', is even.';
    } else if (($number % 2) == 1 || ($number % 2) == -1) {
      echo 'Your number, ' . $number . ', is odd.';
    } else { // change to exception??
      echo 'Your number, ' . $number . ', is fractional.';
    }
  } else { // change to exception??
    echo 'Your input, "' . $number . '", is not a number.';
  }
}

Orson

PS. Perhaps we should change the errors to throw exceptions instead of printing 
random stuff out.


_______________________________________________

UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net

Reply via email to