Thursday, January 3, 2019



Loops in Vbscript

Here is the list of different looping statements in vbscript.

  1. For ....Next
  2. For Each ...Next
  3. Do While...Loop
  4. Do Until....Loop
  5. While...Wend



'You can exit from For Loop with Exit For statement
'For Loop
For i=1 to 3
  Msgbox i*i
Next

'For Each loop
a  = array(22,33,5,3)
For each e in a
 Msgbox a
Next


'You can exit from Do Loop with Exit Do statement
'do while ...loop
i=1
Do while (i<3)
 Msgbox i*i
 i=i+1
Loop

'do until ....loop
i=1
Do until i>3
 Msgbox i*i
 i=i+1
Loop

'You can not exit from while loop using exit statement.
'while........wend
i=1
While i<=3
 Msgbox i*i
 i=i+1
Wend


Related Posts:


0 comments:

Post a Comment

Blog Archive

Translate

Popular Posts

Total Pageviews

150,585

Blog Archive