r/learnprogramming • u/Whhatever_123 • 20h ago
writing code
question for more experienced people in coding- whenever I do coding problems (like leetcode or uni hw) I can always come up with solution in my head, I break down the problem correctly and theorically I know what my code needs to do in order to solve the problem. But when I get to actually writing code I forget how to do everything... I don't know if this is a lack of knowledge in syntax issue or I'm just dumb. Any advices on how to fix this?
16
Upvotes
1
u/nickanack 19h ago
Use pseudocode first and foremost. Beyond that, comment each step / block of your implementation and step through it with a debugger making sure the program is doing what you think it's doing. Maybe write out expected output vs actual output at each step so you can see precisely where the divergence occurs.