Created
October 21, 2013 19:35
-
-
Save amirci/7089593 to your computer and use it in GitHub Desktop.
Nesting example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public double RefDoingCalculations() | |
{ | |
if (!_firstGuard) | |
{ | |
return 0; | |
} | |
if (!_secondGuard) | |
{ | |
return FirstCalculation(); | |
} | |
if (!_thirdGuard) | |
{ | |
return SecondCalculation(); | |
} | |
return ThirdCalculation(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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