
- VBScript Tutorial
- VBScript - Home
- VBScript - Overview
- VBScript - Syntax
- VBScript - Enabling
- VBScript - Placement
- VBScript - Variables
- VBScript - Constants
- VBScript - Operators
- VBScript - Decisions
- VBScript - Loops
- VBScript - Events
- VBScript - Cookies
- VBScript - Numbers
- VBScript - Strings
- VBScript - Arrays
- VBScript - Date
- VBScript Advanced
- VBScript - Procedures
- VBScript - Dialog Boxes
- VBScript - Object Oriented
- VBScript - Reg Expressions
- VBScript - Error Handling
- VBScript - Misc Statements
- VBScript Useful Resources
- VBScript - Questions and Answers
- VBScript - Quick Guide
- VBScript - Useful Resources
- VBScript - Discussion
VBScript If Else Statements
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.
Syntax
TThe syntax of an if…else statement in VBScript is −
If(boolean_expression) Then Statement 1 ..... ..... Statement n Else Statement 1 ..... .... Statement n End If
Flow Diagram

Example
<!DOCTYPE html> <html> <body> <script language = "vbscript" type = "text/vbscript"> Dim a : a = 5 Dim b : b = 25 If a > b Then Document.write "a is Greater" Else Document.write "b is Greater" End If </script> </body> </html>
When the above code is executed, it produces the following result −
b is Greater
vbscript_decisions.htm
Advertisements