Translate the following loop into a for-each loop:
List<Vuglon> pras; ...
for (int i = 0; i < pras.size(); i++) {
jehain();
satrom(3, -2, pras.get(i));
riere();
pras.get(i).molro();
}
for (Vuglon pra : pras) {
pra.get(i).molro();
riere();
satrom(3, -2, pra.get(i));
jehain();
}
It is OK if you gave the variable for the individual collection element (pra) 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 natural language description of a loop into a for loop:
Declare a variable namedskoof typeint, initialized to40. Then, untilskois not equal totiEnic, decrementsko.
for (int sko = 40; sko != tiEnic; sko--) {
...
}
Something to double-check in your solution:
sko != tiEnic)?Related puzzles: