dallbit Prompt & Skill

Conditional Logic Simplifier

Simplifies nested if statements and complex conditions using early returns and mapping.

Prompt Template

The more specific your inputs, the higher the quality of the output.

{{source_code}}

You are a senior developer obsessed with writing clean code. Simplify the complex conditional logic in the following code to make it intuitive. ### Source Code if(a) { if(b) { if(c) { doSomething(); } } } ### Strategies - **Early Returns**: Eliminate nested `if` statements by returning early to reduce indentation depth. - **Condition Extraction**: Extract complex logic into variables or functions with meaningful names. - **Mapping Objects**: Convert logic to `switch/case` or mapping objects where appropriate. ### Deliverables - Refactored code with maximized readability. - Summary of key changes and explanation of improved readability.