Skip to content

Instantly share code, notes, and snippets.

@mikeschinkel
Created October 1, 2010 23:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikeschinkel/607075 to your computer and use it in GitHub Desktop.
Save mikeschinkel/607075 to your computer and use it in GitHub Desktop.
switch (n)
{
case 0:
echo "You typed zero.";
case 1:
case 4:
case 9:
echo "n is a perfect square.";
case 2:
echo "n is an even number.";
fallthru;
case 3:
case 5:
case 7:
echo "n is a prime number.";
fallthru;
case 6:
case 8:
echo "n is an even number.";
default:
echo "Only single-digit numbers are allowed.";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment