what is diff b/n these 2 programs
1) for i=5 to 1 step 2
msgbox "pass"
next
2_) for i=5 to 1 step -2
msgbox "pass"
next

Answers were Sorted based on User's Feedback



what is diff b/n these 2 programs 1) for i=5 to 1 step 2 msgbox "pass" next 2_) for i..

Answer / veer

From the first one will not display any message box because the condition is not true but it shows result as "done" in the result window .

From the second one will display a message box "pass" 3 times

Is This Answer Correct ?    8 Yes 0 No

what is diff b/n these 2 programs 1) for i=5 to 1 step 2 msgbox "pass" next 2_) for i..

Answer / mano

the above answer is right but in second program pass wil display 3 times

Is This Answer Correct ?    6 Yes 0 No

what is diff b/n these 2 programs 1) for i=5 to 1 step 2 msgbox "pass" next 2_) for i..

Answer / manisha

In the first one it will not display any result.Because the
condition given is wrong .

In the second one the result is displayed as pass for 3
times.

Condition for ForLoop:-
the limit must be in increament order (OR) if the limit is
decreament order we have to mention "Step -n",where n is
to skip or jump .


In the above example:-
For the 1st - no result
for the 2nd - The result is displayed as pass for 3 times.
because for i=5 to 1 step -2
i=5
i=3(jumped to 5-2=3)
i=1(jumped to 3-2=1)

Is This Answer Correct ?    5 Yes 0 No

what is diff b/n these 2 programs 1) for i=5 to 1 step 2 msgbox "pass" next 2_) for i..

Answer / ankit

OH ya...i agree
it will show message 3 times

Is This Answer Correct ?    4 Yes 0 No

what is diff b/n these 2 programs 1) for i=5 to 1 step 2 msgbox "pass" next 2_) for i..

Answer / ankit

the first one will not print any message because the
condition is not true

the second one will print message pass 2 times

Is This Answer Correct ?    1 Yes 4 No

Post New Answer

More VB Script Interview Questions

Am working with web application. i faced one senario. i.e, webpage having webtable having two coloumns, in that first coloumn is for serial no and second coloumn is for mac address link, now i want to get first row second coloumn value, that having macaddress as link. Please help me how to get that link?

2 Answers  


Can someone please tell me what poor design in a relational database (not the layout or style) is and how it can be avoided? PLEASE...im desperate.

0 Answers  


Explain about the functionality of vb script?

0 Answers  


which is the bset training centre to learn automation tools?

2 Answers  


How strcomp function works?

0 Answers  






Which data type/types are supported by vbscript language and what are their specialties?

0 Answers  


Write a Script for ATM in QTP

0 Answers  


compare the string without using stringcomp function?

1 Answers   CSS Corp,


what is the object hyrarchy in QTP for a web based application

0 Answers  


What is dictionary object in vbscript? Explain?

0 Answers  


after medical test,when will be the police verification

0 Answers   IBM,


What are the uses of vb script?

0 Answers  


Categories