# Thread: There Must Be Another Way!

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 ...

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();```
Thanks!
Last edited by Delinitor; 07-10-2012 at 06:44 PM. Reason: Formatting

2. Student
Join Date
Jul 2012
Location
United States
Posts
328
Rep Power
5

## Re: There Must Be Another Way!

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

3. Super n00b
Join Date
Jun 2012
Location
The Internetz
Posts
17
Rep Power
0

## Re: There Must Be Another Way!

Originally Posted by awinston

Java Code:
```for(int i = 1; i < 6; i++)
{
if(updateLoop2 == points[i])
number1++;
}```
Thanks! This is exactly what I was looking for.

4. Student
Join Date
Jul 2012
Location
United States
Posts
328
Rep Power
5

## Re: There Must Be Another Way!

You're welcome!