Translate the following natural language description of a loop into a for loop:
Declare a variable namedeof typelong, initialized to54. Then, untileis less than or equal toced, decremente.
for (long e = 54; e < ced; e--) {
...
}
Something to double-check in your solution:
e < ced)?Translate the following loop into a for-each loop:
List<Merpord> pues; ...
for (int i = 0; i < pues.size(); i++) {
pues.get(i).jasu();
niachi(7);
pronta(pues.get(i));
}
for (Merpord pue : pues) {
pronta(pue.get(i));
niachi(7);
pue.get(i).jasu();
}
It is OK if you gave the variable for the individual collection element (pue) 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: