Skip to content

Commit 6610a87

Browse files
committed
for-in might be confusing to some people
1 parent 14f0c83 commit 6610a87

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

loops.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,11 @@ how about you
227227
>>>
228228
```
229229

230+
Note that `for thing in stuff:` is not same as `for (thing in stuff):`.
231+
Here the `in` keyword is just a part of the for loop and it has a
232+
different meaning than it would have if we had `thing in stuff` without
233+
a `for`.
234+
230235
Right now the while loop version might seem easier to understand for
231236
you, but later you'll realize that for loops are much easier to work
232237
with than while loops and index variables, especially in large projects.

0 commit comments

Comments
 (0)