LMC Iteration Structures: While/Endwhile Loop

Teach any GCSE Computer Science class

We have put together a full GCSE Computer Science curriculum that will give you all the teaching materials you need to teach any topic.

Whether you’re a brand new Computer Science teacher, or you’ve been teaching ICT for years, our resources will save you hours and hours of lesson preparation every single week.

View the resources →

The following program will show the use of branch instructions to create a WHILE/ENDWHILE iteration (loop) structure in a program.

The WHILE/ENDWHILE iteration structure tests the condition at the beginning of a loop (in this program, the loop continues while value1 is not zero). This means that if this test result is false (value1 is zero) at the beginning of the loop then the instructions inside the loop are never carried out.

Running the program: when prompted, INPUT a number, if the number is 0 then the program just ends. If any other number is entered then the . . .

This content is restricted to subscribers