Friday, 15 August 2014

How to use FOR EACH loop in QTP



-> FOR EACH loop used to execute every single element or item in a group.

-> Normally its used to like

1) Every single element in an Array
2) Every single files in a folder
3) Every character in a String

in these type of situation we can use FOR EACH loop.

Syntex

For Each [Item] In [Group]
   [loopBody]
Next [Item]


Example :

a=Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")

For each str In a
print str
Next

output :

Sunday
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday



From above example, we print the every element in array.


No comments:

Post a Comment