V
5

My kid asked me to explain loops while we were sorting laundry

I mean, it was a fun way to connect coding to everyday stuff. Idk, maybe it's just me but seeing how loops work in a real task helped both of us get it.
3 comments

Log in to join the discussion

Log In
3 Comments
jackson.sage
Hey wait, that's actually more like a conditional statement, not a loop. You're checking each piece of laundry for a condition, like "if it's a sock, put it here." A real loop would be doing the same exact thing to each item. Like, folding every shirt the same way, one after another. Still a cool way to teach the basics though.
8
shane357
shane3574d agoMost Upvoted
But loops can have if statements inside them too.
8
abby_martinez
My mom used to do this with baking, where the recipe is the loop and checking if the egg is bad is the if statement. It’s cool how much of life runs on that simple logic.
1