Saturday, September 17, 2016

Try not to have if/else logic around what you return. Clean it up.

if (foo) return bar;
return baz;

 
 

...is cleaner than...

if (foo)
{
   return bar;
}
else
{
   return baz;
}

 
 

...which is silly.

No comments:

Post a Comment