Boucle de VBScript While ... Wend
Dans un While..Wend boucle, si la condition est vraie, toutes les instructions sont exécutées jusqu'à ce que Wend le mot clé est rencontré.
Si la condition est fausse, la boucle est quittée et le contrôle passe à l'instruction suivante après Wend mot-clé.
Syntaxe
La syntaxe d'un While..Wend boucle dans VBScript est -
While condition(s)
[statements 1]
[statements 2]
...
[statements n]
Wend
Représentation schématique
Exemple
<!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>
Lorsque le code ci-dessus est exécuté, il imprime la sortie suivante dans la 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