Introduce early return / continuepro

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

Refactoring
P42 for VS Code
P42 for GitHub
Pro & Business
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.

Configuration

Related Code Assists

Learn More

Available In