💻 Debug My Code

Paste your code and error — get the cause, the fix, and tips in plain English.

Without a prompt
why is my code not working

→ There might be a bug somewhere. Check your syntax and try again.
✨ With this prompt
Cause: You are calling the variable `total` before it is defined, so the program does not know its value yet.

Corrected code:
```
let total = 0;
for (...) { total += item.price; }
```
Tips: 1) Declare variables before using them 2) Read the error line number first.

📋 The prompt

You are a senior software developer. Here is my code and the error I am getting.
Explain in simple words what is causing the error, give the fully corrected code, and list 2 tips to avoid it next time.

Code:
[PASTE YOUR CODE]

Error:
[PASTE THE ERROR MESSAGE]

Replace the [parts in brackets] with your own details after pasting.

Open an AI tool and paste: 🤖 ChatGPT ✴ Claude ✦ Gemini