VBScripting

Share Embed Donate


Short Description

Download VBScripting...

Description

VBScripting Variable Variable is a memory location where w here we can store the values.

riables are primarily categorized into 2 Types. Scalar Variables ( It Can Hold Only 1 Value ) Array Variables ( It Can Hold Multiple M ultiple Value ) VB Script This Variables are Further Divided into 2 types Implicit Variable : If a Variable is used with out declaring , Then it is Called Implicit Variable . Ex: a=10 b=20 c=a+b In the above Program a , b , c are Called Implicit Variable. Explicit Variable : If a variable is declared and utilized then This variables are called Explicit Variable . You Can Declare a Variable Using Dim . Ex 1 : Dim a,b,c

a=10 b=20 c=a+b In the above Program a , b , c are Called Explicit Variable. te : By Default VB Script Allows both implicit and Explicit Variables Ex 2 : Dim a,b a=10 b=20 c=a+b In the above Program a , b are Called Explicit Variable and c is Called Implicit Variable. te : There is a draw back with Implicit Variable , i.e. A Spelling Mistake M istake also Consider as a new Variable because of this you may get In Correct Results . Ex 3 : Dim a,b,c a=10 b=20 c=a+d msgbox c

tion Explicit It Instructs VB Scripting DonĀ¶t Allow Implicit Variable. Option Explicit statement is specified Then every variable Must be clared before Using that Variable. Ex 4 : Option Explicit Dim a,b,c a=10 b=20 c=a+d msgbox c ou Will get Error in Above Program ray Variable Array Variables are useful to Store Multiple M ultiple Values. Ex : Dim sname(5)

-

You can not Resize The Array

ReDim sname(5)

-

You can Resize The Array

Ex 1: Dim sname(5)

sname(0)="A" sname(1)="B" sname(2)="C" sname(3)="D" sname(4)="E" msgbox sname(1) Dim sname(10) te : It will Produce a error YBCZ in Dim we Can Not Resize Ex 2: ReDim sname(5) sname(0)="A" sname(1)="B" sname(2)="C" sname(3)="D" sname(4)="E" msgbox sname(1) ReDim sname(10) sname(5)="F" msgbox sname(1) te :

It will show Null Value in sname(1) YBCZ There Is no Preserve Ex : ReDim sname(5) sname(0)="A" sname(1)="B" sname(2)="C" sname(3)="D" sname(4)="E" msgbox sname(1) ReDim preserve sname(10) sname(5)="F" msgbox sname(1) Operators Arithmetic Relational Logical Concatenation Assignment

Arithmetic + Addition

- Subtraction * Product /

Division

Relational =

Equals to



Compare

>

Greater then

<

Less then

>=

Greater then or Equals to

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF