Mark Zuckerberg explains how loops in code automate repetitive tasks. Instead of manually writing birthday emails to every Facebook user, which would take a century, a few lines of code sends them all automatically.
Chapters
One thing that computers are really good at is repeating commands. As a person, you'd get really bored if you had to do the same thing lots of times in a row. But a computer can do the same thing millions or even billions of times and not get bored and be able to carry that out really well. So, for example, if I wanted to wish everyone on Facebook a happy birthday by sending them an email, it might take me more than a century to actually write out all of those emails to everyone. But with just a few lines of code, I can have a system send an email to everyone on Facebook wishing them a happy birthday. So that's what loops are and why they're valuable and something that computers can do very well.