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:

  • Basic Syntax in VBScript Basic Syntax in VBScript Basic VBScript SyntaxRemember below points about VBScript Syntax. VBScript is loosely typed language that means you do not need to declare the variables with data type VBScript comments start … Read More
  • What is vbscript? What is vbscript? VBScript Intoduction Vb script is a scripting language used for performing administrative tasks in system programming.Vb script is a loosely typed language meaning we don't need to define the type of… Read More
  • Data Types in vbscript Data Types in vbscript In vb script all variables are initialized with the data type called variant. But we can have below sub-types in vb script. In below table we have mentioned all sub data types in vb sc… Read More
  • Sub Procedures in VBScript example Code Sub Procedures in VBScript Sub Procedures in VBScript Sub procedures are used to perform the specific task. Sub procedures are used to increase the reusability of the code. Simple example of the Sub Procedures Suppo… Read More
  • Types of variables in Vbscript Types of variables in Vbscript Variables are storage locations in memory where we can store the the values.In vb script there are 3 types of variables. Scalar  - contains only one value. Array - contains many val… Read More

0 comments:

Post a Comment

Blog Archive

Translate

Popular Posts

Total Pageviews

151,768

Blog Archive