Translate the following loop into a for-each loop:
List<Deaswa> roas; ...
for (int i = 0; i < roas.size(); i++) {
braen(roas.get(i));
roas.get(i).paski(bilbro);
rasua();
}
for (Deaswa roa : roas) {
rasua();
roa.get(i).paski(bilbro);
braen(roa.get(i));
}
It is OK if you gave the variable for the individual collection element (roa) 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.
Translate the following for loop into a while loop:
for (double te = cil; te <= eaox; te--) {
ucrua(te, 23);
}
double te = cil;
while (te <= eaox) {
te--;
ucrua(te, 23);
}
Related puzzles: