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

Could Anybody tell me the VBscript for REVERSE an Integer int reverse(int num) Ex:246 to 642

7 Answers   Amazon,


HOW TO OPEN NEW TAB USING VB SCRIPT IN QTP?

1 Answers   TCS,


Input = 124 output should be 124421 Please do not use any string functions/variables

8 Answers   Cap Gemini,


Out of the different type of operators, which are evaluated first and last in the vbscript language?

0 Answers  


How to capture a runtime error in vbscript?

0 Answers  






write a vb script to add two 2*2 matrix

2 Answers  


why do u choose to go for testing why cant for devoloping

0 Answers  


Which conditional statement is the most convenient one to use in the case of multiple conditions in the vbscript language?

0 Answers  


How will you get a string with the specified character the specified number of times in vbscript?

0 Answers  


write a function to read the items from combobox of Flight reservation & save in excel (QTP)??

0 Answers  


we executed QTP scripts in one browser(i.e IN)same scripts is working on another browsers or not (i.e mean netscap,m azol..like )

6 Answers   Accenture,


hai all.iam chandu..please let me know how to test a link in QTP when it is changing at run time..and what property we should take while we r using descriptive programming for a link..

6 Answers  


Categories