LOOP STATEMENTS:
The execution of a block of code more then one time is called as loop. Like all programming language vbscript is also allows you to create different types of loops.
A) While loop:-
To run a block of code as long as condition was true.
EX:-1
Option explicit
Dim i, j
i=1
j=inputbox(“enter the number”)
while(i<=j)
msgbox(i)
wend
EX:-2
To display all even numbers , in between 1 to limit.
Option explicit
Dim i, x
X=inputbox(“enter the number limit”)
i=2
while(i<=cint(x))
print i
i=i+2
wend
No comments:
Post a Comment