Поделиться через


Expected 'While,' 'Until,' or end of statement

You created a Do loop, but did not include the associated While or Until keywords. The test condition of a Do loop requires either a While or an Until keyword in the test condition statement. The following demonstrates the correct structure of a Do loop.

                      Do [{While | Until} condition]
   [statements]
   [Exit Do]
   [statements]
Loop 

Or, you can use this syntax:

                      Do 
   [statements]
   [Exit Do]
   [statements]
Loop [{While | Until} condition]

To correct this error

  • Make sure that the Do loop includes all the necessary parts.

  • Terminate the Do loop with either the While or Until keywords.

See Also

Concepts

Looping Through Code

Reference

Do...Loop Statement

For...Next Statement

For...Next Statement

While...Wend Statement

Exit Statement