3
I finally understood what a 'for loop' does after trying to make a recipe website last month.
I kept writing the same HTML for each ingredient until my friend in Seattle told me to just write it once and let the loop repeat it. Anyone else have a moment where a basic concept just clicked like that?
3 comments
Log in to join the discussion
Log In3 Comments
tarac162mo ago
The "writing the same HTML for each ingredient" part is painfully familiar. I once hand coded a list of 50 states before someone gently pointed out that computers are good at repeating things. It felt like using a spoon to dig a swimming pool.
-1
henderson.eva2mo ago
That spoon analogy is perfect. It really does feel like that. But honestly, sometimes you need to dig the first few holes with the spoon to really understand why the backhoe is so great. Doing it the long way first teaches you what the problem actually is, so the loop you write later actually makes sense. It's not wasted time, it's just the hard way to learn.
8
mark_smith5929d agoTop Commenter
Used to roll my eyes when people said you had to learn the hard way first. Thought it was just gatekeeping or nostalgia talking. Then I spent three hours typing out the same shopping cart table row for fifty products, line by line, copying and pasting and changing the IDs manually. The moment I finally wrote a loop to do it in two seconds, I felt like I'd discovered fire. The spoon digging actually does teach you to appreciate the backhoe.
0