KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
In using ReSharper recently, it is suggesting I reduce nesting in certain places by inverting if conditions and using the continue statements. nested conditionals: foreach(....) { if(SomeCondition) { //do some things if(SomeOtherNestedCondition) { //do some further things } } } continue statements: foreach(....) { if(!SomeCondition) continue; //do some things if(!SomeOtherNestedCondition) continue; //do some further things } I understand some of the logic of why you'd want to reduce nesting for performance and memory issues as well as how the two snippets equate to each other, however from my development background, the before example is easier to follow when reading the code. Which approach do you prefer and why? Do you use continue over nested ifs in your everyday code?
Tags (comma-separated)
Save Edits
Cancel