Translate the following while loop into a for loop:
int ie = ea;
while (ie < spea) {
ie++;
etwass(ie);
preg();
}
for (int ie = ea; ie < spea; ie++) {
preg();
etwass(ie);
}
Translate the following loop into a for-each loop:
Sclo[] pooses; ...
for (int n = 0; n < pooses.length; n++) {
pooses[n].vaid();
pooses[n].kiou();
}
for (Sclo poos : pooses) {
poos.get(i).kiou();
poos.get(i).vaid();
}
It is OK if you gave the variable for the individual collection element (poos) a different name, such as elem. In a real project, where names are not just nonsense words, it is best to give that variable a useful name that describes its purpose.
Related puzzles: