Results 1 to 4 of 4
Thread: There Must Be Another Way!
- 07-10-2012, 06:42 PM #1
Super n00b
- Join Date
- Jun 2012
- Location
- The Internetz
- Posts
- 17
- Rep Power
- 0
There Must Be Another Way!
Is there an easier way of doing this? The large number of if() statements is causing me to doubt myself ...
Thanks!Java Code:if(updateLoop==points[1]){ number1 += 1; } if(updateLoop2==points[2]){ number1 += 1; } if(updateLoop2==points[3]){ number1 += 1; } if(updateLoop2==points[4]){ number1 += 1; } if(updateLoop2==points[5]){ number1 += 1; } etc();Last edited by Delinitor; 07-10-2012 at 06:44 PM. Reason: Formatting
- 07-10-2012, 07:10 PM #2
Student
- Join Date
- Jul 2012
- Location
- United States
- Posts
- 328
- Rep Power
- 1
Re: There Must Be Another Way!
How about:
Java Code:for(int i = 1; i < 6; i++) { if(updateLoop2 == points[i]) number1++; }Last edited by awinston; 07-10-2012 at 07:11 PM. Reason: variable name
- 07-10-2012, 07:58 PM #3
Super n00b
- Join Date
- Jun 2012
- Location
- The Internetz
- Posts
- 17
- Rep Power
- 0
- 07-10-2012, 11:23 PM #4
Student
- Join Date
- Jul 2012
- Location
- United States
- Posts
- 328
- Rep Power
- 1


1Likes
LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks