Lesson 17. Customizing loops

After reading lesson 17, you’ll be able to

  • Write more-complicated for loops that start and end at custom values
  • Write loops that iterate over strings

You write programs so you can make the user’s life easier in some way, but that doesn’t mean that the programmer’s experience with writing a program should be tedious. Many programming languages have added customizations to certain language constructs so that a programmer can take advantage of them and write code more efficiently.

Consider this

You give your spouse a list of movies you want to watch over the course of one year. Every odd-numbered movie is action, and every even-numbered movie is comedy:

  • What pattern can you follow to reliably make sure ...

Get Get Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.