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:

  • Dictionary Object in vb script Example Dictionary Object in vb script Example Dictionary object is used to store the data in key-item pairs in qtp.A Dictionary object is just like an associative array.It stores the data in the form of key-item pairs.Each k… Read More
  • Regular Expressions in vb script example Regular Expressions in vb script example Regular expressions BasicsDefinition :A regular expression is a pattern of characters(meta characters and special characters). General Applications of Regular Expression… Read More
  • File system object in vb script File system object in vb script Filesystemobject can be used to work with drives, folders, and files.Filesystemobject  has methods and properties that allow us to create, delete, gain information about, and gener… Read More
  • What is Windows Script Host? What is Windows Script Host? WSH is a scripting host for Windows Script compatible scripting engines.WSH supports various scripting languages like vbscript, javascript, python etc.You can do below operations using WSH… Read More
  • Error handling in VBScript Error handling in VBScript VBScript provides below statements and keywords to handle errors. on error resume next Err object - err.description, err.number Sample code to handle the error is given below If er… Read More

0 comments:

Post a Comment

Blog Archive

Translate

Popular Posts

Total Pageviews

152,245

Blog Archive