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:

  • Maths functions in vbscript Maths functions in vbscript Below is the list of all maths functions in vb script Abs  Atn  Cos  Exp  Fix  Int  Log  Rnd  Sgn  Sin  Sqr  Tan  round Let us … Read More
  • Classes in VBScript Classes in VBScript Here is an example that shows how we can create a class in QTP. Once we define the class, we can create its objects and then access its method and properties. 'declare the class book. Class Bo… 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
  • String functions in vbscript String functions in vbscript Below is the list of string functions in vb script lcase ucase len left right mid ltrim rtrim trim replace strreverse string Instr Instrrev strcomp We are going to have a look at each St… 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

0 comments:

Post a Comment

Blog Archive

Translate

Popular Posts

Total Pageviews

151,938

Blog Archive