Skip to content

Lesson 18: Introduction to for loops #304

@NathanLovato

Description

@NathanLovato

Solves: doing things a fixed number of times or processing every element of a list.

In this introductory lesson, we only show how to repeat code a fixed number of times using the range() function. We can present the range function as producing a list of numbers.

It allows us to first introduce the concept of for loops and later build upon it with lessons dedicated to arrays.

Unlike while loops, for loops do not run infinitely, so it is much less likely that you will get bugs in your game. Because of that, we recommend favoring for loops over while loops.

To cover:

  • Looping a fixed number of times (range)

Metadata

Metadata

Assignees

Labels

contentIssues with the lessons, practices, including their code examples

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions