IF statement inside a for loop

# Thread: IF statement inside a for loop

1. Member
Join Date
Dec 1969
Posts
67

## IF statement inside a for loop

I&#039;m in a for a loop and I can&#039;t get my If statement to work properly.<BR>I&#039;m outputting results to the screen and want to display a grade with each result.<BR>Testing with numbers 17 and 41 and I&#039;m getting a D for both numbers. I should be getting an NG and then a D.<BR>Any help is appreciated,<BR>Eoin<BR><BR>Response.Write arrMark(i) <BR> <BR> If 0&#060;i&#060;=20 Then<BR> result = "NG"<BR> End IF<BR> <BR> If 20&#060;i&#060;=45 Then<BR> result = "D"<BR> <BR> End IF

2. Member
Join Date
Dec 1969
Posts
67

## RE:Sincere apologies for posting twice

Sincere apologies for posting twice, browser error

3. Senior Member
Join Date
Dec 1969
Posts
2,809

## RE: IF statement inside a for loop

Have you debugged this thing? Try something like<BR><BR>If i &#062; 0 AND i &#060;=20 Then<BR>result = "NG"<BR>End IF<BR><BR>If i &#062; 20 AND i&#060;=45 Then<BR>result = "D"<BR><BR>End IF<BR><BR>Wrap i in a Cint or CDbl if that doesn&#039;t work. Hardcode i and see what happens.<BR><BR>Wait...I just noticed Response.Write arrMark(i) <BR><BR>Are you sure you don&#039;t mean<BR>If arrMark(i) &#062; 0 AND arrMark(i) &#060; 20 Then<BR> result = "NG"<BR>End If<BR><BR>?<BR>

4. Member
Join Date
Dec 1969
Posts
67

## Thanks a million Bill

Bill u brought me out of an infintite loop of stupidity.<BR>Thanks a million,<BR>Eoin

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•