Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
27 lines (21 sloc) 1.19 KB
I think that people
would be surprised by the amount of depth that there can be in
something as superficially simple as a for-loop. For instance:
- simple incrementing for-loops such as counting from 1 to 10 printing the index.
- simple decrementing for-loops such as counting from 10 to 1 printing the index.
- using for-loops to replace recursion for instance traversing a tree and printing out the nodes
- learning to reason about nested for-loops
- looking at the ways in which different languages implement them and
getting a sense for the ways in which they are more or less equivalent
but some languages have more powerful constructs than others
- the evolution of modern varieties of for-loops
- for-else loops for instance in Python
- the interaction between for-loops and co-routines: and McIlroy's original paper
- the relationship between for-loops and other kinds of loops e.g.
while-loops, do-while loops and Knuth's loop and a half construct:
Implement each of these in one or more languages
- learning how to hoist variables out of for-loops