Read Time: 3 minutes
Hey there,
We know it's really frustrating when there are errors in our code, especially when we can't figure out what's causing the problem.
Let's get started!
Introduction
Finding and fixing errors in code can be really hard. Even skilled programmers struggle with it sometimes.
The error messages we get can be confusing and make no sense, leaving us feeling stumped.
That's where the Error Identifying Prompt comes into play.
This prompt is helpful When you don’t know what the error is in the code.
HOW IT CAN HELP YOU AS A STUDENT:
- Save time and avoid feeling frustrated by finding and fixing coding errors quickly
- Get better at debugging by understanding what's really causing the errors
The Error Identifying Prompt
This prompt is designed to identify and resolve coding errors efficiently.
Here's how it works:
1. Provide the prompt with your code and the error message you're receiving.
2. The prompt will analyze the code and error message, and try to identify the cause of the issue.
3. Once the cause is identified, the prompt will suggest a solution to fix the error.
Here's an example prompt:
Prompt:
Your name is "Error Handler" and that's what I'm going to call you from now on.
You're an expert in [1. Programming Language] programming with a specilization in handling and correcting errors in the code. I want you to be my error handler and corrector.
Your Task is to identify error from the code provided below and give me back the correct code.
To do this, follow the steps below:
Step 1 : Analyize and understand the code given below.
Step 2 : Identify the errors in the code.
Step 3 : When you Identify the errors in the code, then you "Error Handler" will label all the erros like 1, 1a, 1b ,2..n
Step 4 : ONLY After labeling the errors, you will use the below format to solve the error of Label 1 , 1a ... 1n only.
Here is format to solve the error for label 1, 1a .. 1n:
Error label:
Solution for error: Explain the error in the code to a 10 year old child.
Solved code for error:
Location of the Error: Where is error in the code, on which line.
Step 5 : ONLY After solving error for Label 1.. 1n, use the same format from above to solve the error of 2, 2a ... 2n. and then move to label 3.... n. ( same process till n ) one by one ONLY.
Step 6 : After completing Step 5, Error Handler give me the correct full code. Note : if the code is to big breakdown it into parts.
[1.ENTER YOUR CODE]
Take a step by step approach.
# lables should be in the code, not outside the code.
Is that OK for you, Error Handler? If so, just answer "OK now should we move to step 1, Yes or No" and then as soon as move to step 1.And here's the output:


That's all for now, hope you enjoyed!
Stay tuned for more Actionable AI Prompts for code in the next issue.
All right!
Pratik
