0% found this document useful (0 votes)
56 views

VBscript Operators

This document discusses VB Script operators including arithmetic, comparison, logical, and concatenation operators. It provides examples of using exponentiation, multiplication, division, modulus, addition, subtraction, and concatenation operators on numbers and strings. Comparison operators like greater than, less than, equal to and not equal are also demonstrated. Logical operators like Not, And, Or, and Xor are explained along with examples and truth tables showing how they evaluate true and false conditions. Operator precedence is also briefly covered.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views

VBscript Operators

This document discusses VB Script operators including arithmetic, comparison, logical, and concatenation operators. It provides examples of using exponentiation, multiplication, division, modulus, addition, subtraction, and concatenation operators on numbers and strings. Comparison operators like greater than, less than, equal to and not equal are also demonstrated. Logical operators like Not, And, Or, and Xor are explained along with examples and truth tables showing how they evaluate true and false conditions. Operator precedence is also briefly covered.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 6

VB Script Operators

--------a) Arithmetic
b) Comparison
c) Logical
---------Concatenation
------------------------Operator precedence
Ex:
x= 3+4*2
Msgbox x '11
x= (3+4)*2
Msgbox x '14
-------------------------------------------a) Arithmetic
-----------------1) Exponentation ^
2) Multiplication
3) Division /
4) Integer \
5) Mod
6) Addition +
7) Subtraction 8) Concatanation &
--------------------------Example:
---------Dim a, b, c
a= 10
b=3
c= a ^ b
Msgbox c '1000
1

c= a * b
Msgbox c '30
c= a / b
Msgbox c '3.3333333333
c= a \ b
Msgbox c '3
c= a Mod b
Msgbox c '1
c= a - b
Msgbox c '7
-------------------------------------------Dim a, b, c
a= 10
b=3
c= a + b
Msgbox c '30
a= "10"
b=3
c= a + b
Msgbox c '30
a= "10"
b="3"
c= a + b
Msgbox c '103
a= "Hyderabad"
b="111"
c= a + b
Msgbox c 'Hyderabad111
a= "Hydera"
b="bad"
c= a + b
Msgbox c 'Hyderabad

a= "Hyderabad"
b=3
c= a + b
Msgbox c 'Error
---------------------------------------------& Operator
------------Dim a, b, c
a= 10
b=3
c= a & b
Msgbox c '103
a= "10"
b=3
c= a & b
Msgbox c '103
a= "10"
b="3"
c= a & b
Msgbox c '103
a= "Hyderabad"
b="111"
c= a & b
Msgbox c 'Hyderabad111
a= "Hydera"
b="bad"
c= a & b
Msgbox c 'Hyderabad
a= "Hyderabad"
b=3
c= a & b
Msgbox c 'Hyderabad3
----------------------------------------

2) Comparision (All have equal precedence)


>
>=
<
<=
=
<>
--------------Examples:
Dim a, b, c
a= 10
b=3
c= a > b
Msgbox c 'True
c= a >= b
Msgbox c 'True
c= a <> b
Msgbox c 'True
c= a < b
Msgbox c 'False
c= a <= b
Msgbox c 'False
c= a = b
Msgbox c 'False
--------------------------------------------Logical Operators
----------------1) Not (Logical Negation)
If Not Dialog("Login").Exist(3) Then

SystemUtil.Run "C:\Program Files\HP\QuickTest


Professional\samples\flight\app\flight4a.exe","","C:\Program Files\HP\QuickTest
Professional\samples\flight\app\","open"
End If
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set "asdf"
Dialog("Login").WinEdit("Password:").SetSecure
"502b09c1824499622ed0ec320cfea74cc5d0e952"
Dialog("Login").WinButton("OK").Click
--------------------------------------------------------2) And (Logical Conjunction)
Ex:
Dim a, b, c
a=100
b=50
c=70
If a>b And a>c Then
Msgbox "A is a Big Number"
Else
Msgbox "A is Not a Big Number"
End If
Result Criteria:
----------------Exp1 Exp2 Result
---------------------True True True
True False False
False True False
False False False
3) Or (Logical Disjunction)
Result Criteria:
----------------Exp1 Exp2 Result
---------------------True True True
True False True
False True True
False False False

4) Xor (Logical Exclusion)


---------------------------------Result Criteria:
----------------Exp1 Exp2 Result
---------------------True True False
True False True
False True True
False False False

You might also like