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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to use QTP Object in .vbs(vbscript file) file Ex: Browser().., wait(), exist() and etc...

2905


create a form to accept username and password validate the username and password with using message box, display the corresponding user message

2164


Explain about the extension .hta?

627


Which in-built functions are used to convert the specified expression in the form of date and string in the vbscript language?

546


Develop a parameterized action that accomplishes the following a. Launch a browser of users choice ( example : IE, chrome etc) b. Open up a search engine (Google, Bing etc) c. Perform a search d. Click a particular link depending on the user’s choice ( 1st , 2nd or third link)

1415






Capture the Unique label changes on google home page for I am feeling lucky button and save those label changes to Notepad Note: Using QTP

1877


1. How do declare public variable in vb scripts?

1579


How are values assigned to the variables in the vbscript language?

579


What is the use of the date function in the vbscript language?

569


What are the advantages of vbscript?

648


Explain about scrrun.dll?

536


How to assign a numeric value to a variable?

624


In html file what is an ideal position to include vbscript?

815


How can the spaces from the string be removed?

593


i wrote vbscripit code in notepad i got error i am in learning stage if u ps tell me what wrong in my code my error is "object required descriptive at line one run time error"and my code is "set usernameobj=Descriptive.Create() usernameobj( "name").value="Username" set passwordobj=Descriptive.Create() passwordobj("name").value="password" set signinobj=Descriptive.Create() signinobj("name").value="sigin" browser("gmail").page("gmail").WebEdit("usernameobj").set ("enter username") Browser("gmail").Page("gmail").WebEdit("passwordobj").Set secure.Crypt.Encrypt("enter password") browser("gmail").page("gmail").WebButton("siginobj").click

1421