Ask Question
7 December, 00:56

How do i describe a strategy for avoiding nested conditionals.

+5
Answers (1)
  1. 7 December, 02:19
    0
    The target code is in the middle here and has a nice path up to it, however connecting the dots for the else conditions isn't quite as clear. While this code might be understandable in the heat of writing, if you decided later that userOwnsCat () needed to be true for a user to log in, and you wanted a specific error condition for it ... things get messy, quickly. Essentially, this code is not maintainable.

    There's no issue with the logic in this nested example - it's just badly organised. The very same logic can be written in such a way that it only ever goes one level deep, and there's not much to it either.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “How do i describe a strategy for avoiding nested conditionals. ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers