Lesson 3.1 · College Board Unit 2
For Loops
A for loop initializes once, checks its condition before each iteration, and updates after the body. Track the first included and first excluded value.
Code Scholars Tutoring · AP Computer Science A
Repetition, and the accounting that makes it correct. The unit is less about loop syntax than about knowing what each variable means after one pass, which is the only reliable way to get bounds and accumulators right.
Lesson 3.1 · College Board Unit 2
A for loop initializes once, checks its condition before each iteration, and updates after the body. Track the first included and first excluded value.
Lesson 3.2 · College Board Unit 2
A while loop can run zero times. Identify a changing quantity that eventually makes the condition false.
Lesson 3.3 · College Board Unit 2
For each outer iteration, the inner loop starts again. When inner bounds depend on the outer index, count each row separately.
Lesson 3.4 · College Board Unit 2
A counter records how many items satisfy a condition; an accumulator combines their values. Initialize both outside the traversal.
Work through questions with a tutor and get help with the steps you find difficult.
Get help with this topic