Tour : VBScript - Decision Making Statement

Step 1. What is Decision Making Statement?
Step 2. Types of Decision Making Statement
Step 3. VBScript If Statement
Step 4. VBScript If else Statement
Step 5. VBScript If elseIf Statement
Step 6. VBScript Nested If else Statement
Step 7. VBScript Switch Statement
Step 8. Visit GoLearningBus.Com for more "www.vbsedit.com" training

1.What is Decision Making Statement?

Decision making is about deciding the order of execution of statements based on certain conditions or repeat a group of statements until certain specified conditions are met

Go to Toparrow-1

2.Types of Decision Making Statement

VBScript provides following types of decision making statements.
1) If Statement,
2) If else Statement,
3) If elseIf Statement,
4) Nested If else Statement,
5) Switch Statement

Go to Toparrow-1

3.VBScript If Statement

An If statement consists of a boolean expression followed by one or more statements. If the condition is said to be True, the statements under If condition(s) are Executed. If the Condition is said to be False, the statements after the If loop are executed.

When this code is executed, it produces the following result "Inside If condition"

Go to Toparrow-1

4.VBScript If else Statement

An If statement consists of a boolean expression followed by one or more statements. If the condition is said to be True, the statements under If condition(s) are Executed. If the Condition is said to be False, the statements under Else Part would be executed.

When this code is executed, it produces the following result "Inside Else condition"

Go to Toparrow-1

5.VBScript If elseIf Statement

An If statement followed by one or more ElseIf Statements that consists of boolean expressions and then followed by a default else statement, which executes when all the condition becomes false. When this code is executed, it produces the following result "c is greatest".

Go to Toparrow-1

6.VBScript Nested If else Statement

An If or ElseIf statement inside another If or ElseIf statement(s). The Inner If statements are executed based on the Outermost If statements. This enables VBScript to handle complex conditions with ease. When this code is executed, it produces the following result "c is greatest".

Go to Toparrow-1

7.VBScript Switch Statement

When a User want to execute a group of statements depending upon a value of an Expression, then Switch Case is used. Each value is called a Case, and the variable being switched ON based on each case. Case Else statement is executed if test expression doesn't match any of the Case specified by the user. Case Else is an optional statement within Select Case, however, it is a good programming practice to always have a Case Else statement. When this code is executed, it produces the following result "Inside Switch 2".

Go to Toparrow-1

8.Visit GoLearningBus.Com for more "www.vbsedit.com" training

Visit GoLearningBus.Com for more "www.vbsedit.com" guided tours and training.
For only $10 you can access more than 300 apps for a lifetime of learning and training.

Go to Toparrow-1