Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [looping]

Use this tag for questions related to teaching and learning the various forms of repetition in computer programming. Tradeoffs between the various semantic forms can be discussed. This tag is not appropriate for specific recursion questions, though questions relating to comparison of recursive vs repetitive solutions might be.

4
votes
7answers
262 views

Pedagogical reasoning behind a minor difference in two loops

I keep seeing examples like the first program bellow, in teaching materials. Is there a pedagogical reason to teach this first program, compared to the second? ...
8
votes
6answers
419 views

Single-dimensional array and simple looping activities of significance

I give a lab on single-dimensional loops and arrays. By "single dimensional loops", I mean that there is no nesting of loops. (I will later give a second lab on multi-dimensional loops and arrays, ...
3
votes
2answers
179 views

Using physical activity to explain the nested for loop

I have been rewriting my unit on nested for loops for AP Computer Science (thus, we are using Java). I would like to use some sort of physical activity to drive home the differences between roughly ...
6
votes
7answers
905 views

Example for For vs While Loop (in Java)

I'm looking for a set of concrete examples that illustrates good use cases of using a for vs a while loop for beginners. I feel ...
6
votes
11answers
1k views

Teaching the tradeoffs of the foreach loop

Edit: It's been quite a while since I posted this question, and in the intervening time, I have come to love the foreach loop. However, in order to avoid invalidating answers, I leave the text ...
34
votes
13answers
5k views

Teaching the humble for loop

So, in C-style languages, the for loop has a funny little syntax: for (int i = 0; i < 100; i++){ // do something } If ...
6
votes
4answers
471 views

How to teach which loop should be used

In most languages, there are many different types of loops. The most common ones seem to be for loop, while loops, and do while loops. What is the best way to illustrate the differences between the ...