The While loop statement is used to repeatedly execute a statement while a particular specified condition is True. And once the condition is considered to be False, the processing drops out of the loop.

While loops nearly always contain multiple statements.

After the statements within the loop are executed, there will always be another statement to increment the counter.

The structure of a While statement is while <Condition> do <Statement>.

Execute A Statement While The Condition Is True

This example executes the LogInfo statement multiple times.

procedure ScriptEvent (var Value : variant);
begin
Value := 1;
while Value < 10 do
begin
LogInfo('Value is equal to '+IntToStr(Value));
Value := Value + 1;
end;
end;

The counter is manually set to 1 outside of the While loop, using the variable called Value.

Each time the While loop executes, the counter variable called Value is incremented by 1.

Eventually Value will no longer be less than 10, therefore processing will stop.