Skip to main content
Share Your Experience: Take the 2024 Developer Survey

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.

Filter by
Sorted by
Tagged with
5 votes
5 answers
271 views

For and while loops examples for 12-13 years old class

I teach in a secondary, first grade, school in Italy. The kids are 13 years old, on last year before second grade. I am teaching them the very basic of programming. Last year we did some flowcharts ...
Corrado's user avatar
  • 51
7 votes
6 answers
720 views

What are good, practical labs and activities for loops?

I am teaching some high school students, also the first time programmers, some basic programming concepts and applications. When introducing loop I find that using it to check prime number (and find ...
Qiulang 邱朗's user avatar
11 votes
7 answers
2k views

Order to teach looping constructs in a non ideal language

In an ideal teaching language If the language directly supports them then the order to teach looping constructs seems simple. Infinite loop: forever. Simple finite ...
ctrl-alt-delor's user avatar
4 votes
7 answers
289 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? ...
ctrl-alt-delor's user avatar
7 votes
6 answers
455 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, ...
Ben I.'s user avatar
  • 33.7k
3 votes
2 answers
391 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 ...
Ben I.'s user avatar
  • 33.7k
7 votes
7 answers
2k 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 ...
cryptic_star's user avatar
5 votes
12 answers
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 ...
Ben I.'s user avatar
  • 33.7k
41 votes
14 answers
7k 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 ...
Ben I.'s user avatar
  • 33.7k
6 votes
4 answers
961 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 ...
i--'s user avatar
  • 831