Debugging Logic - Steps for Learners

Modified on Fri, 9 Aug at 2:49 PM

When to use 

If you have written code but 

1. On run code, output doesn't match the expected output 

2. On submit, test cases fail


How to use

Step 1

Read out and explain the problem statement and sample input/output like you are explaining it to someone who doesn't have context on the problem


Step 2

Read through each line of code, line by line, and explain what each line does to implement the problem statement


Step 3

Use the visualiser below to check the value of variables at each line of code and confirm these are as expected 


Visualiser link: Visualiser


To use the visualiser (Visualiser Demo)

1. Paste your code in the visualiser

2. Ensure there are no errors (this might include calling the function)

3. Go line by line on the visualiser and observer the values of variables closely

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article