O'Reilly logo

VBScript in a Nutshell, 2nd Edition by Ron Petrusha, Matt Childs, Paul Lomax

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

While . . . Wend Statement

Syntax

While condition
   [statements]
Wend
condition

Use: Required

Data Type: Boolean

An expression evaluating to True or False.

statements

Use: Optional

Program statements to execute while condition remains True.

Description

Repeatedly executes program code while a given condition remains True.

Rules at a Glance

  • A Null condition is evaluated as False.

  • If condition evaluates to True, the program code between the While and Wend statements is executed. After the Wend statement is executed, control is passed back up to the While statement, where condition is evaluated again. When condition evaluates to False, program execution skips to the first statement following the Wend statement.

  • You can nest While...Wend loops within each other.

Programming Tips and Gotchas

The While...Wend statement remains in VBScript for backward compatibility only. It has been superseded by the much more flexible Do...Loop statement.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required