Thursday, January 3, 2019


What are different conditional statements in vbscript?

In Vbscript there are 2 types of conditional statements.

  1. if ...else
  2. Select Case
Example of if else - 


a = 10

If a > 10 Then
  Msgbox "a is greater than 10"
ElseIf a>0 then
  Msgbox "a is between 0 and 11"
Else
  Msgbox "a is not greater than 0"
End If




Example of select case - 


a = Inputbox("enter the number")


Select Case cint(a)

  Case 1  

     msgbox "You entered 1"

  Case 2
     msgbox "You entered 2"

  Case 3
     msgbox "You entered 3"

  Case else
     msgbox "You entered invalid input"

End Select



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
  • 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
  • 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,983

Blog Archive