Sunday, November 14, 2010

if - else is really a great thing! You can't use it too much!

Senior developers sometimes show their ablilties by writing extremely clever methods. This provides their junior-fellows with a good source for education and real admiration:


bool CheckNumberOfElements(double[] container, int maxLength)
{
if (container.Length > maxLength)
return true;
else
{
if (container.Length < maxLength)
return false;
else
{
if (container.Length == maxLength)
return false;
else
{
if (container.Length != maxLength)
return true;
}
}
}
}

No comments:

Post a Comment