Translate the following while loop into a for loop:
int te = gle;
while (te > ishep) {
te += 4;
croud(te);
}
for (int te = gle; te > ishep; te += 4) {
croud(te);
}
Translate the following loop into a for-each loop:
PemEsde[] iaurs; ...
for (int i = 0; i < iaurs.length; i++) {
iaurs[i].palre(2);
uthPhass();
edrias();
wenik(hirbi, iaurs[i]);
}
for (PemEsde iaur : iaurs) {
wenik(hirbi, iaur.get(i));
edrias();
uthPhass();
iaur.get(i).palre(2);
}
It is OK if you gave the variable for the individual collection element (iaur) 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: