Forums
This topic is locked
looping problem
Posted 07 Nov 2002 17:02:12
1
has voted
07 Nov 2002 17:02:12 suhail kaleem posted:
<pre id=code><font face=courier size=2 id=code><%
n=0
'j=1
for i=0 to j
if n<>90 then
j=j+1
response.write "<br>j= "&j
end if
n=n+1
response.write "<br>n= "&n
next
'This must loop 90 times but it loops 1 time why is that ?
'anyhelp ?
%>
</font id=code></pre id=code>
Replies
Replied 08 Nov 2002 04:09:13
08 Nov 2002 04:09:13 Dave Blohm replied:
because you have the upper limit of your loop set to j, not n
Try this:
<%
n=0
'j=1
Do While n < 90
'for i=0 to j
If n<>90 Then
j=j+1
Response.Write "<br>j= " & j
End If
n=n+1
Response.Write "<br>n= " & n
'next
Loop
%>
Doc
Rangewalk Digital Studios
Edited by - on 08 Nov 2002 04:13:54
Try this:
<%
n=0
'j=1
Do While n < 90
'for i=0 to j
If n<>90 Then
j=j+1
Response.Write "<br>j= " & j
End If
n=n+1
Response.Write "<br>n= " & n
'next
Loop
%>
Doc
Rangewalk Digital Studios
Edited by - on 08 Nov 2002 04:13:54
Replied 08 Nov 2002 20:09:58
08 Nov 2002 20:09:58 suhail kaleem replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
because you have the upper limit of your loop set to j, not n
Try this:
<%
n=0
'j=1
Do While n < 90
'for i=0 to j
If n<>90 Then
j=j+1
Response.Write "<br>j= " & j
End If
n=n+1
Response.Write "<br>n= " & n
'next
Loop
%>
Doc
Rangewalk Digital Studios
Edited by - on 08 Nov 2002 04:13:54
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
It should increase the upper limit of loop when it loops one time as j=j+1
but it doen not do that
i want to loop the code depending on the varibale value that is inside the loop but i am unbale to do this any one can tell em how can i loop a code depending on the variable value that is inside the loop ?
Suhailkaleem
because you have the upper limit of your loop set to j, not n
Try this:
<%
n=0
'j=1
Do While n < 90
'for i=0 to j
If n<>90 Then
j=j+1
Response.Write "<br>j= " & j
End If
n=n+1
Response.Write "<br>n= " & n
'next
Loop
%>
Doc
Rangewalk Digital Studios
Edited by - on 08 Nov 2002 04:13:54
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
It should increase the upper limit of loop when it loops one time as j=j+1
but it doen not do that
i want to loop the code depending on the varibale value that is inside the loop but i am unbale to do this any one can tell em how can i loop a code depending on the variable value that is inside the loop ?
Suhailkaleem