Introduce early return / continue

Change an if-statement into an early return or continue statement.

Introduce early return / continue

Why is this refactoring helpful?

If-else chains can lead to high indentation and require keeping track of many conditions, especially when there are several levels of nesting. Introducing early return statements (or continue statements inside loops) can reduce the nesting level and lower the cognitive load because you can entirely rule out already covered conditions.


Related Code Assists

Learn More

Available In