Translate the following loop into a for-each loop:
List<Chre> isses; ...
for (int i = 0; i < isses.size(); i++) {
trung(isses.get(i));
crii(9, -1, isses.get(i));
}
for (Chre iss : isses) {
crii(9, -1, iss.get(i));
trung(iss.get(i));
}
It is OK if you gave the variable for the individual collection element (iss) 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 while loop into a for loop:
double no = 44;
while (no <= cei) {
no--;
cipiac(no, 27);
dodtom();
}
for (double no = 44; no <= cei; no--) {
dodtom();
cipiac(no, 27);
}
Related puzzles: