Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 for i = X to X
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

redbrad0
Advanced Member

USA
3725 Posts

Posted - 28 October 2001 :  19:29:33  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
I am trying to use the for statment which i can do it, but not the way i want. What I am trying to do is output a list of numbers descending. I know how to use it like..


<%
for i=1910 to 2001
%>
<option><%=i%></option>
<%
next ' i
%>


Which would list
1910
1911
1912
1913

but i want it to be in descending order

example:
2001
2000
1999
and so on.

what do i need to do to get this done?

Brad

Da_Stimulator
DEV Team Forum Moderator

USA
3373 Posts

Posted - 28 October 2001 :  19:37:21  Show Profile  Send Da_Stimulator an AOL message  Send Da_Stimulator a Yahoo! Message
did you try Lbound()?

---------------
Da_Stimulator has spoken
Go to Top of Page

Davio
Development Team Member

Jamaica
12217 Posts

Posted - 28 October 2001 :  20:05:45  Show Profile
LBound() is used with arrays.

I'm wondering redbrad, why not count from 2001 to 1910 instead?
<% for i=2001 to 1910 Step -1 %>
<option><% =i %></option>
<% next %>


- David
Go to Top of Page

Da_Stimulator
DEV Team Forum Moderator

USA
3373 Posts

Posted - 28 October 2001 :  20:47:55  Show Profile  Send Da_Stimulator an AOL message  Send Da_Stimulator a Yahoo! Message
sorry i mis-took it for an array at first

---------------
Da_Stimulator has spoken
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 29 October 2001 :  13:11:02  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
quote:

I'm wondering redbrad, why not count from 2001 to 1910 instead?
<% for i=2001 to 1910 Step -1 %>
<option><% =i %></option>
<% next %>




Well i did try this, but i didnt put step-1 so ill try that. i never knew about the step command

Brad
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 29 October 2001 :  14:12:59  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
I tried this and it didnt work...


<%
for i=1910 to 2001 step -1
%>
<option><%=i%></option>
<%
next ' i
%>


any other ideas?

Brad
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 29 October 2001 :  14:20:33  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
humm it just worked ; /

For i = 2001 to 1910 step -1
%>
<option><%=i%></option>
<%
next ' i

whats different?

Brad
Go to Top of Page

Davio
Development Team Member

Jamaica
12217 Posts

Posted - 29 October 2001 :  14:20:35  Show Profile
redbrad, that's not the code I posted.
You need to be counting from 2001, not from 1910. Look at the code again.

That code you just posted is going to start counting from 1910 and backwards, so of course it wouldn't work.

- David
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 29 October 2001 :  14:21:32  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
lol, sorry. im still asleep thanks davio

Brad
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 31 October 2001 :  00:21:17  Show Profile  Visit Gremlin's Homepage
Step is used to control the increment used when the command is looping between the first and second numbers specified in the loop. If your couting form a larger to smaller number than use a negative step, for counting up it would be a postivie number

Halo of Xegony
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 31 October 2001 :  13:13:23  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
thanks germlin

Brad
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.25 seconds. Powered By: Snitz Forums 2000 Version 3.4.07