Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

By default in vbscript the arguments passed to functions and subroutines are by reference or by value?

1019


How to create a function in vbscript?

1138


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

3380


Explain the scope of the variables using dim, public, and private keywords respectively.

1099


Explain the adodb.stream class?

930


how to automatically update the sql server2005 database records when insert in vb6?

1885


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

988


What are events in the vbscript language?

1047


What is the scope of a constant declared using public?

915


How will you compare two strings in vbscript?

998


What are the data types supported by vbscript?

1043


what is inner join? what is outer join? what is a constraint? tell me about rdbms? tell me about acid properties?

1859


What is the technology used by vb script?

916


Which in-built function related to an array joins substrings into one string in the vbscript language?

906


How will you check that a variable is an array in vbscript?

948