Deep Dive: Loop Examples

Test yourself on Iteration (Loops) with exam style questions, marked instantly.

Flashcards that come back just before you would forget them.

A revision plan that remembers what you know and shows what to do next.

See which topics you have nailed and which need another look.

Quiz yourself on Iteration (Loops)Get your flashcardsBuild my revision planTrack my progress

Deep Dive: Loop Examples

FOR loop (count-controlled):

for i = 1 to 5
    OUTPUT i
next i
// Output: 1 2 3 4 5

WHILE loop (condition-controlled):

password = ""
while password != "secret"
    INPUT password
endwhile

DO UNTIL loop in OCR style (runs at least once; AQA writes REPEAT ... UNTIL):

do
    INPUT choice
until choice >= 1 AND choice <= 3

Make this stick

Signing in gives access to all PrepWise features.

PrepWise is a trading name of A3M Quality Solutions Limited, registered in England and Wales, company number 14959172. Registered office: 202 Stroud Road, Gloucester, GL1 5LA. ICO registration ZC267069.