Hi there!

Hi there!
My name is Michael Ivanov and i'm a Senior SDE/Software architect.
My CV - here. You can find articles and other blog posts on the main page. I also develop some free and commercial software - complete list is here.

Monday, May 24, 2010

Never return!

Never return in the middle of the function.
Never return in the middle of the function.
Never return in the middle of the function.
Never return in the middle of the function.
Never return in the middle of the function.

If you don't want code behind return to be executed, rever conditions of return

Instead of
if(returnCondition) return yourValue;
/// some code


write
if(!returnCondition)
{
//// some code
}
return yourValue;


Never return in the middle of the function.

No comments: