Arrays – in VBScript

An Array is a data structure which can hold multiple variables of the same type.  So far whatever the examples we have seen in the previous posts we have used variables for each value. ans=a*b Here, variable a and the variable b are multiplied and the result is stored back in the variable ans. Let …

Function Procedure in VBScript

Function procedure is a discrete block of code that is written to accomplish a particular task.  The difference between a Sub procedure and Function procedure is that function can return a value.  Syntax: Function {name} (parameters)     – – – – – –     – – – – – –     – – – – …

Modularization with Functions and Sub procedures in VBScript

Dividing the entire software program into smaller chunks of code where each piece handles a specific task is known as modularization.  Following are some of the benefits: Easy to maintain Reusability Easier to debug More reliable Hence, all programming languages and scripting languages support modularization.  In vbscript modularization can be achieved with two different techniques: …

Do . . . Loop in VBScripting

This looping statement provides a great way to execute a group of statements until a condition is true.  There might be lot of situations where we can specify a condition but not the iterations (i.e. no minimum and maximum values or array containing elements). In such situations we can go ahead and use this loop. …

For . . . Each . . Next loop in VBScript

There will be some situations where we do not know the number of iterations, but we need to execute a block of code for all the elements in an array (its a data type) or for all the objects.  Here, array and object concepts are new but having look at the following script makes it …

For Loop in VBScripting

In vbscript to execute set of statements FOR LOOP can be utilized.  There are two variants of this are present.  Let us start with the first one. 1. For . . . Next Syntax: For {integer variable}={initial value} to {Max value for the variable} Step {incremental value e.g. –2, 1, 2, etc} . . . …

Looping Statements in VBScript

Let us have a look at the following vbscript: msgbox "Hello world" msgbox "Hello world" msgbox "Hello world" msgbox "Hello world" msgbox "Hello world" msgbox "Hello world" msgbox "Hello world" msgbox "Hello world" This is simply printing one message eight times.  This looks pretty simple!!! But, if we need to repeat 50 of such statements …

VBScript – Flow Control with Conditional Statements

The vbscript is executed line by line until the end of the script and this order of execution is called flow.  The execution flow can be controlled by certain commands or statements in vbscript.  Following are the conditional statements which are used to control the order of execution. If … Then … Else Select Case …

VBScript – Logical, Comparison, and Concatenation Operators

Logical Operators To compare two different variables and also to evaluate the Boolean expressions logical operators are used. Let us have look at these one by one: AND expression1 AND expressions2 There will be four different combinations, E1 AND E2 (E1=True, E2=True) = True.  If both the expressions are true then the result will be …