Iteration - Computer Science GCSE GURU
Maybe your like
Iteration is the term given to the repetition of a block of statements (code) within a computer program. Basically, think loops!
There are 3 types of iteration that you need to learn for GCSE:
- FOR .. TO .. NEXT
- REPEAT .. UNTIL
- WHILE .. DO .. ENDWHILE
Programming languages may put their own syntax/wording on these loop structures, but look closely and you’ll see that they do relate back to the above list.
Not all loops behave in the same way so it is important to choose the right iteration code for the job/purpose.
REPEAT .. UNTIL ..

After each iteration of the loop a condition is checked to see if an exit criteria has been met yet.
This means that at least one iteration of the loop will be executed.
Because the condition/check is placed at the bottom of the loop, this is referred to as bottom testing (or a post condition).
Example

WHILE .. DO .. ENDWHILE

A condition tests whether to enter the loop, or simply bypass it.
If the loop is entered, the condition is checked again before each iteration to see if the criteria has been met yet (to exit the loop).
Because the condition is placed at the start of the loop, this is referred to as top testing (or a pre-condition).
Example

FOR .. TO .. NEXT

The amount of iterations (times around the loop) is predetermined (fixed) at the beginning of the loop.
This type of loop is ideal when you already know how many iterations of the code is required.
Example

Related Theory
- 2D Arrays
- Arrays
- Counting and Totalling
- Data Types (in computer programs)
- Library Routine
- Selection
- Testing and Test Data
- Validation
- Variables and Constants
- Verification
Related Quizzes
- Programming Data Types
- Selection and Iteration
- Testing and Test Data
- Validation and Verification
Tag » What Is Iteration In Computer Science
-
What Is Iterative? - TechTarget
-
What Is Iteration? - Definition From Techopedia
-
Iteration - Computer Science Wiki
-
Iteration In Algorithms - KS3 Computer Science Revision - BBC
-
What Is Iteration In Programming? - AfterAcademy
-
Iteration - Wikipedia
-
FAQ: What Is An Iteration In Computer Science? (With Examples)
-
Definition & Types Of Iteration - Teach Computer Science
-
Iteration - Isaac Computer Science
-
What Is Iteration? - Quora
-
What Is An Iteration? - Computer Hope
-
Iteration Examples In Real Life And Computer Programming
-
7. Iteration — How To Think Like A Computer Scientist
-
The Building Blocks Of Algorithms - Khan Academy