Skip to content

Instantly share code, notes, and snippets.

@tany3
Last active August 29, 2015 13:56
Show Gist options
  • Save tany3/9245645 to your computer and use it in GitHub Desktop.
Save tany3/9245645 to your computer and use it in GitHub Desktop.
冗長なelse - Redundant 'else' keyword

##冗長なelse - Redundant 'else' keyword ブロック節を使って直ぐにreturnするならば、elseは要らない。

###変更前

if (!collection.Any())
{
  return false;
}
else
{
  //何かの処理
}

###変更後

if (!collection.Any())
{
  return false;
}
//何かの処理
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment