VKS-LEARNING HUB

Home » Class-XI » MMWT-XI » VB Script » Operators

Operators

Arithmetic or Algebraic Operators  handles mathematics operation on one or more variable

Operator

Operation/

Meaning

Usage

Resultant Value

+

Addition

A=10

B=4

Sum=A+B

SUM=14

Subtraction

A=10

B=4

Diff=A-B

Diff=6

*

Product/Multiply

A=10

B=4

Prod=A*B

Prod=40

/

Division

A=10

B=4

Value1=A/B

Value1=2.5

\

Integer Division

A=10

B=4

Value2= A\B

Value2=2

^

Exponent

A=10

B=2

Value3=A^B

Value3=100

Mod

Remainder

A=10

B=4

Value4= A Mod B

C=16.6

D=4.2

Value5=C MOD D

Value4=2

Value5= 1

Vb script automatically convert 16.6=17 &

4.2 =4

Relational Operator are used to compare one or more variable, numbers constants. It always return a True or False result

  Operator

Operation/

Meaning

Usage

Resultant Value

=

Equality

A=B

Check whether  A is equal to B or not, If A is equal to B it gives True otherwise False

<> 

Inequaity

A<>10

A should not equal to 10 for any other value it give True but if A is 10 then give False

Less than

A<10

Check whether  A is Less than 10 or not, If A is Less than 10 it gives True otherwise False

Greater than

A>10

Check whether  A is Greater than 10 or not, If A is Greater than 10 it gives True otherwise  False

<=

Less than or Equal to

A<=10

Check whether  A is Less than or equal to 10 or not, If A is Less than or equal to 10 it gives True otherwise False

>=

Greater than or Equal to

A>10

Check whether  A is Greater than or equal to 10 or not, If A is Greater than or equal to 10 it gives True otherwise  False

String Concatenation using ( &) and (+)

Operator (&) Operator (+)
operator (&) is used to merge or combine two string to form a new string operator (+) is used to merge or combine two string to form a new string but does not always produce correct answer as it also used as addition operator for numeric value

Example 1 

A= Web

B= Multimedia

C= A&B

C will become WebMultimedia

Example 2 

A=10

B=1

C=A&B

C will become 101

Example 1 

        A= Web

B= Multimedia

C= A+B

C will become WebMultimedia

Example 2 

A=10

B=1

C=A+B

C will become 11

Division Operator (/)

Division Operator (\)

The floating-point division operator is designed to divide values and return quotient with decimal points, but it can also return quotient without decimals. operator handles only integer numbers without decimal points. Usually referred to as the Integer-point division operator. If we use this operator with floating-point(decimal) it gives the integer value only
Example 1 A= 6.6B= 2

C= A/B

C will become 2.3

 D=6

E=2

F=D/E

F will become 3

 

Example 1 A= 6.6B= 2C= A\BC will become 2

 


Leave a comment