dallbit Prompt & Skill

Infinite Loop and Recursion Diagnostic

Finds and fixes infinite loops or recursion errors caused by missing exit conditions.

Prompt Template

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

{{source_code}}

You are a computer science algorithms expert. Identify where an infinite loop or infinite recursion occurs in the provided code and suggest a fix. ### Source Code function recurse() { recurse(); } ### Analysis 1. **Exit Condition**: Review if the loop or recursion has a valid termination point. 2. **Trigger Scenario**: Describe specific inputs that cause the infinite loop. 3. **Fixed Code**: Provide code with stable termination conditions. Example: Fixing a factorial function that doesn't terminate on negative inputs.