6
I was watching a YouTube tutorial from a channel called 'Code Basics' and realized I'd been writing my for loops backwards for a year.
The host said 'start small, then go big' and I finally saw I was putting the bigger number first. Anyone else have a simple rule that fixed a big coding mistake?
2 comments
Log in to join the discussion
Log In2 Comments
coleman.karen1mo ago
Start small, then go big" is such a good way to put it. I read something once about always picturing the number line in your head, left to right, to remember which way the loop goes. It seems obvious after you hear it, but how many hours did we all waste getting it backwards?
6
elizabeth_gonzalez1mo ago
That number line trick @coleman.karen mentioned is a total lifesaver. It's funny how the simplest mental picture can fix something that feels so hard. I still sometimes draw a tiny arrow on my paper as a reminder before I even start writing the loop, just to make it stick. Saves a lot of staring at the screen wondering why nothing's working.
6