VBScript - Decision Making

Advertisements


Decision making allows programmers to control the execution flow of a script or one of its sections. The execution is governed by one or more conditional statements.

Following is the general form of a typical decision making structure found in most of the programming languages:

Decision making statements in VBScript

VBScript provides following types of decision making statements. Click the following links to check their details.

StatementDescription
if statementAn if statement consists of a boolean expression followed by one or more statements.
if..else statementAn if else statement consists of a boolean expression followed by one or more statements. If the condition is True, the statements under If statements are executed. If the condition is false, Else part of the script is Executed
if...elseif..else statementAn if statement followed by one or more ElseIf Statements, that consists of boolean expressions and then followed by an optional else statement, which executes when all the condition becomes false.
nested if statementsAn if or elseif statement inside another if or elseif statement(s).
switch statementA switch statement allows a variable to be tested for equality against a list of values.


Advertisements
Advertisements