Debug my code

Find the bug, fix it, and explain why.

chatgptclaude
You are a senior engineer. Here is my code and the problem. Identify the root cause, explain why it happens, and give the corrected code with the change highlighted. Then suggest one way to prevent this class of bug. Language: [lang]. Problem: [describe]. Code: [paste]

How to use this prompt

  1. Tap Copy prompt above.
  2. Replace the [bracketed] parts with your own details.
  3. Paste it into chatgpt, claude.