Control Statements VBScript | Automation Testing QTP/UFT

There are two types of Control Statements VBScript

  1. Conditional Statements
  2. Loop Statements

Statement: Each and every line in VBScript

Let’s see both Conditional control statements and Looping control statements below

CONDITIONAL CONTROL STATEMENTS VBScript:

Used to execute single statements or set of statements based on conditions.

The following Conditional statements are available in VB Script:
IF STATEMENT: executes a set of statement when a condition is true
IF – ELSE STATEMENT: select one of two sets of statements to execute
IF – ELSEIF STATEMENT: select one of many sets of statements to execute
SELECT CASE STATEMENT: select one of many sets of statements to execute

Click here to see Conditional control statements in detail

LOOPING CONTROL STATEMENTS VBScript:

Looping control statements allow to run a group of statements repeatedly when the condition is true.
Following looping control statements are available in VBScript:
While…Wend statement – It executes only when a condition is true. Use the Do-Loop statement instead of this.
Do – Loop While statement – loops  while a condition is true
Do While – Loop statement – It executes one time even if the condition is False
Do – Loop Until statement – loops  until a condition is true
For…Next statement – runs code a specified number of times
For Each…Next statement – runs code for each item in a collection or each element of an array

Click here to see looping control statements in detail

Control Statements VBScript

Get our latest blog posts delivered to your inbox

Subscribe and get popular blog posts about software testing industry.

Rajkumar

Leave a Comment

Share via
Copy link
Powered by Social Snap