November 2022
Beginner
368 pages
6h 47m
English

Nothing is worse than needing to do the same thing over and over. There’s a reason we’re told to count sheep when we’re having trouble falling asleep, and it has nothing to do with the amazing sleep-inducing powers of woolly mammals. It’s because endless repetition is boring, and your mind can drift off to sleep easily if you’re not focusing on something interesting.
Programmers don’t like repeating themselves either, unless they’re also trying to fall asleep. Thankfully, most programming languages have a for loop, which repeats things like statements and blocks of code automatically.
In this chapter, we’ll look at for loops, as well ...