Operator
precedence
a=10+20*2
msgbox
a '50
a=(10+20)*2
msgbox
a '60
1) Arithmetic
a)
^ Exponentiation
b)
* multiplication
c)
/ division
d)
\ Integer division
e)
Mod operator
f)
+ Addition
g)
- subtraction
h)
& concatenation
Example:
Dim
a,b,c
a=10
b=3
c=a^b
msgbox
c '1000
c=a*b
msgbox
c '30
c=a/b
msgbox
c '3.33333333
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=2
c=3
d=c*a^b
'c=a+b
msgbox
d '1000
Addition
(+) operator
Dim
a,b,c
a=10
b=2
c=a+b
msgbox
c '12 (if both are numeric, then it
adds)
a="10"
b=2
c=a+b
msgbox
c '12 (one is string another numeric,
then it adds)
a="10"
b="2"
c=a+b
msgbox
c '102 (if both are strings, then it concatenates)
a="hydera"
b="bad"
c=a+b
msgbox
c 'hyderabad
a="gagan"
b=2
c=a+b
msgbox
c 'error
Concatenation
Operator
Dim
a,b,c
a=10
b=2
c=a&b
msgbox
c '102
a="10"
b=2
c=a&b
msgbox
c '102
a="10"
b="2"
c=a&b
msgbox
c '102
a="hydera"
b="bad"
c=a&b
msgbox
c '102
2)
Comparison Operators (have equal precedence)
a)
=
b)
<
c)
<=
d)
>
e)
>=
f)
<>
Example:
Dim
a,b,c
a=10
b=2
c=a=b
msgbox
c 'false
c=a<b
msgbox
c 'false
c=a>b
msgbox
c 'true
3)
Logical (have equal precedence)
a) Not
(Logical Negation)
If
not window("Flight Reservation").Exist (3) Then
SystemUtil.Run
"D:\Program Files\HP\QuickTest
Professional\samples\flight\app\flight4a.exe","","D:\Program
Files\HP\QuickTest Professional\samples\flight\app\","open"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent
Name:").Set "fsdfsf"
Dialog("Login").WinEdit("Password:").SetSecure
"4bda42ce3f38c716e0de9aadc2cdb242d58a0d1d"
Dialog("Login").WinButton("OK").Click
End
If
For
ord= 1 to 5
Window("Flight
Reservation").Activate
Window("Flight
Reservation").WinButton("Button").Click
Window("Flight
Reservation").Dialog("Open Order").WinCheckBox("Order
No.").Set "ON"
Window("Flight
Reservation").Dialog("Open Order").WinEdit("Edit").Set
ord
Window("Flight
Reservation").Dialog("Open
Order").WinButton("OK").Click
Next
b) and
(Logical conjunction)
Exp 1 Exp2 Result
True True True
True False False
False True False
False False False
Dim
a,b,c
a=100:b=20:c=30
If
a>c and a>b Then
msgbox "a is a big number"
else
msgbox
"a is Not a big number"
End
If
c) or
(Logical disjunction)
d) xor
(Logical exclusion)
No comments:
Post a Comment