Written by the Fiveable Content Team โข Last updated September 2025
Verified for the 2026 exam
Verified for the 2026 examโขWritten by the Fiveable Content Team โข Last updated September 2025
Definition
A counter is a variable that keeps track of a value, usually used to count or iterate through a loop.
Related terms
Increment: Incrementing means increasing the value of something by a specific amount. For example, if you increment a counter by 1, its value will increase by 1.
Loop: A loop is a programming construct that allows you to repeat a set of instructions multiple times. Counters are often used in loops to control how many times the loop should run.
A variable is a named storage location in computer memory that can hold different values during program execution. Counters are typically implemented as variables.