Translate the following for loop into a while loop:
for (int ete = 83; ete < luEsoc; ete--) {
oicElho(ete, 34);
}
int ete = 83;
while (ete < luEsoc) {
ete--;
oicElho(ete, 34);
}
Translate the following natural language description of a loop into a for loop:
Declare a variable namedrudiof typeint, initialized toerli. Then, untilrudiis less than or equal tolul, decrementrudi.
for (int rudi = erli; rudi < lul; rudi--) {
...
}
Something to double-check in your solution:
rudi < lul)?Translate the following loop into a for-each loop:
List<Dearpun> aclos; ...
for (int i = 0; i < aclos.size(); i++) {
aclos.get(i).durd(betten, -2);
aclos.get(i).uedor(6);
}
for (Dearpun aclo : aclos) {
aclo.get(i).uedor(6);
aclo.get(i).durd(betten, -2);
}
It is OK if you gave the variable for the individual collection element (aclo) 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: