S
29

I kept getting stuck on loops until I started drawing them out with a pen

I was trying to make a program that printed numbers 1 to 10, but it just kept running forever. After staring at the screen for an hour, I grabbed a notebook and drew a box for the starting number and arrows for each step. Seeing it on paper showed me I forgot to increase the number inside the loop, so it was always checking '1'. I fixed it by adding 'i = i + 1' and it worked first try. Now I sketch any tricky loop before I even type the code. Has anyone else found a simple trick like this that finally made loops click?
3 comments

Log in to join the discussion

Log In
3 Comments
sandrajackson
Actually find drawing it out saves a ton of time in the long run. Staring at the screen just makes me more frustrated.
7
jessica_ross38
Ugh, I could never do that. Just seems like extra work to me. I'd rather stare at the screen until my brain figures it out.
3
graceblack
My buddy was stuck on a coding problem for like two days straight... just glaring at his monitor. Finally grabbed a notebook and started sketching the logic flow, and he solved it in twenty minutes. Said it was like his brain needed to see it in a different way, not just on a screen. He felt pretty silly for all that wasted time staring.
5