VBScript mentre ... Wend Loop

In un While..Wend loop, se la condizione è True, tutte le istruzioni vengono eseguite fino a Wend viene rilevata la parola chiave.

Se la condizione è falsa, il ciclo viene chiuso e il controllo passa all'istruzione successiva Wend parola chiave.

Sintassi

La sintassi di a While..Wend loop in VBScript è -

While condition(s)
   [statements 1]
   [statements 2]
   ...
   [statements n]
Wend

Diagramma di flusso

Esempio

<!DOCTYPE html>
<html>
   <body>
      <script language = "vbscript" type = "text/vbscript">
         Dim Counter :  Counter = 10   
         While Counter < 15    ' Test value of Counter.
            Counter = Counter + 1   ' Increment Counter.
            document.write("The Current Value of the Counter is : " & Counter)
            document.write("<br></br>")
         Wend ' While loop exits if Counter Value becomes 15.
         
      </script>
   </body>
</html>

Quando il codice precedente viene eseguito, stampa il seguente output nella console.

The Current Value of the Counter is : 11 

The Current Value of the Counter is : 12 

The Current Value of the Counter is : 13 

The Current Value of the Counter is : 14 

The Current Value of the Counter is : 15