PowerPoint Do... Loop
PowerPoint Do... Loop
Loop statement
12/03/2018 • 2 minutes to read • +1
In this article
Syntax
Remarks
Example
See also
Syntax
Do [{ While | Until } condition ]
[ statements ]
[ Exit Do ]
[ statements ]
Loop
Or, you can use this syntax:
Do
[ statements ]
[ Exit Do ]
[ statements ]
Loop [{ While | Until } condition ]
statements One or more statements that are repeated while, or until, condition is True.
Remarks
Any number of Exit Do statements may be placed anywhere in the Do…Loop as an
alternate way to exit a Do…Loop. Exit Do is often used after evaluating some condition,
for example, If…Then, in which case the Exit Do statement transfers control to the
statement immediately following the Loop.
When used within nested Do…Loop statements, Exit Do transfers control to the loop
that is one nested level above the loop where Exit Do occurs.
Example
This example shows how Do...Loop statements can be used. The inner Do...Loop
statement loops 10 times, asks the user if it should keep going, sets the value of the flag
to False when they select No, and exits prematurely by using the Exit Do statement. The
outer loop exits immediately upon checking the value of the flag.
VB = Copy
See also
Using Do...Loop statements
Data types
Statements