Skip to content

Instantly share code, notes, and snippets.

@amirci
Created October 21, 2013 19:35
Show Gist options
  • Save amirci/7089593 to your computer and use it in GitHub Desktop.
Save amirci/7089593 to your computer and use it in GitHub Desktop.
Nesting example
public double RefDoingCalculations()
{
if (!_firstGuard)
{
return 0;
}
if (!_secondGuard)
{
return FirstCalculation();
}
if (!_thirdGuard)
{
return SecondCalculation();
}
return ThirdCalculation();
}
public double DoingCalculations()
{
var result = 0d;
if (_firstGuard)
{
result = FirstCalculation();
if (_secondGuard)
{
result = SecondCalculation();
// 100 LOC ......
}
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment