Thursday, September 2, 2010

Using Variables

Variable is an item holding data that can change during execution of the program. All variables in VBScript are of datatype called Variant.

Declaring Variables
Declaring a single variables
Declaring Multiple variables

Declaring a single variables
We can declare variables using Dim statement or public statement or private statement
Example:
Dim Variable1
public Variable2
private Variable3

Declaring Multiple variables
We can declare multiple variables by separating each variable name with a comma.
Example:
Dim Coordx, Coordy, Coordz

Standard Rules for Variable Names
  1. Must begin with an alphabetic character (A...Z,a...z) or an underscore character
  2. Cannot contain an embedded period
  3. Must not exceed 255 characters
  4. Must be unique in the scope in which it is declared.
  5. After the first character, variable can contain letters, digits and underscore

Assigning value to Variables

Variable1 = 10

Variable Constants

We can create variable constants using const keyword.

Const Pi = 3.14

Array Variables
An array variables is used to store multiple values in a single variable.
Dim VehicleName(2)
VehicleName(0) = "Volvo"
VehicleName(1) = "Santro"
VehicleName(2) = "Mahindra"

2 comments:

  1. I’m impressed, I need to say. Really rarely do I encounter a blog that’s both educative and entertaining, and let me inform you, you could have hit the nail on the head. Your idea is outstanding; the problem is one thing that not sufficient persons are speaking intelligently about. I'm very completely happy that I stumbled throughout this in my seek for something regarding this. gsn casino slots

    ReplyDelete
  2. ?I used to be very happy to seek out this internet-site.I wanted to thanks on your time for this excellent learn!! I undoubtedly enjoying each little little bit of it and I have you bookmarked to take a look at new stuff you weblog post. online casino bonus

    ReplyDelete