A) For loop:-
We can use this loop to run a block of code specified number of times.
Syntax:- for i=1 to n
--------- ====è loop runs n times.
---------
Next
EX:- for i=1 to 10 step 2
--------- =====è loop runs 5 times
---------
Next
EX:- for i=10 to 1 step (-1)
--------- =====è loop runs 10 times
---------
Next
B) For Each loop:-
We can use this loop to execute a block of code for each item in given list.
Syntax:- for each i in list/array
---------
---------
Next
Arrays:-
Array is a list of values in any type.
EX:- x(4)
101 | Kishore | 23.4 | A | 23a4 |
X(0) x(1) x(2) x(3) x(4)
From the above example, x is an Array with 5 elements . every array first element index is zero, called as Lbound. In index of last element in an array Ubound. So the size of array is Ubound+1.
To store data to an array , we can use below code.
Method:-1 Method:-2
Static Array Dynamic Array
Option explicit option explicit
Dim x dim x(4),i
X=array(“kish”,23,43.22) for i=0 to 4
X(i)=inputbox(“enter value”)
Next
EX:-
To read 5 subject marks of a student and then display total marks.
Option explicit
Dim x(5),I,total
For i=0 to 4
X(i)=inputbox(“enter the subject marks”)
Next
Total=0
For i=0 to 4
Total=total+x(i)
Next
Print(“total=”&total)
Ex:-2
To read 5 subject marks of a student and then display highest marks in list.
Option explicit
Dim x(5),I,max
For i=0 to 4
X(i)=inputbox(“enter the subject marks”)
Next
Max=x(0)
For i=1 to 4
If cint(max)<cint(x(i)) then
Max=x(i)
End if
Next
Print(“maximum marks=”&max)
Ex:-3
To read specify no:of employees & to read every emp salary. If salary graters then equal 30000 the comm. 10% . sal<30000 and sal>=15000, then comm is 5% .If sal<15000, then comm is 200. Here gross salary= bsal+comm. We can replace bsal with gross in that array.
Option explicit
Dim emp(10), noe, i, comm., gsal
noe=inputbox(“enter no:of employess”)
for i=0 to noe-1
emp(i)=inputbox(“enter emp bsal”)
next
for i=0 to noe-1
if(emp(i)>=30000) then
comm.= emp(i)*10/100
gsal=emp(i)+comm.
Emp(i)=gsal
Elseif(emp(i)<30000 and emp(i)>=15000) then
Comm.=emp(i)*5/100
Gsal=emp(i)+comm.
Emp(i)=gsal
Else
Comm.=200
Gsal=emp(i)+comm.
Emp(i)=gsal
End if
Next
For i=0 to noe-1
Print(emp(i))
Next
Thanks for sharing such informative article on Loadrunner Automation testing tool. This load testing tool will provide most precise information about the quality of software.Loadrunner Training in Chennai | Loadrunner training institute in Chennai|Qtp training institutes in chennai
ReplyDeleteThe future of software testing is on positive note. It offers huge career prospects for talented professionals to be skilled software testers.
ReplyDeleteRegards,
Software testing training in Chennai| Best software testing training institute in Chennai|Software testing courses in Chennai
Very useful blog
ReplyDeleteQTP Training In Chennai
Hello there! This is my first comment here, so I just wanted to give a quick shout out and say I genuinely enjoy reading your articles. Can you recommend any other blogs/websites/forums that deal with the same subjects? Thanks.
ReplyDeletefire and safety course in chennai
I would like to greatly appreciate your interest in sharing the info with us. Continue with more recent updates.
ReplyDeleteBest Spoken English Classes in Chennai
Best Spoken English Institute in Chennai
Spoken English Classes in Bangalore
English Speaking Course in Bangalore
Best Spoken English Classes in Bangalore
English Classes in Bangalore
ReplyDeleteHey, would you mind if I share your blog with my twitter group? There’s a lot of folks that I think would enjoy your content. Please let me know. Thank you.
Automation anywhere Training in Chennai | Best Automation anywhere Training Institute in Chennai
uipath training in chennai | Best uipath training Institute in chennai
Blueprism Training in Chennai | Best Blueprism Training Institute in Chennai
Rprogramming Training in Chennai | Best Rprogramming Training Institute in Chennai
Machine Learning training in chennai | Best Machine Learning training Institute in chennai