Course Content
Computer Science 2010 : Olevel : Free Trail Course

The “repeat…until” loop, also known as a post-controlled loop, is a programming construct that iterates a block of code until a specified condition becomes true. Unlike the “while” loop, which evaluates the condition before executing the loop body, the “repeat…until” loop evaluates the condition after executing the loop body, ensuring that the loop body is executed at least once.

In pseudocode, the structure of a “repeat…until” loop looks like this:

repeat
// Code block to be executed
until condition

Here’s an example demonstrating the usage of a “repeat…until” loop in pseudocode: code in Java

total = 0
count = 1

repeat
// Prompt user for input
input_number = input(“Enter a number (enter 0 to stop): “)

// Add input to total
total = total + input_number

Note: no repeat until in python or vb
// Increment count
count = count + 1
until input_number = 0

// Output the total
output(“The sum of the numbers entered is: ” + total)