IF-THEN-ELSE |
WHILE-DO |
for (int index = 0; index < theArray.length; index++) { if (theArray[index].equals(target)) { return index; } } |
int index = 0; while (index < theArray.length && !theArray[index].equals(target)) { index++; } return index; |