Translate the following natural language description of a loop into a for loop:
Declare a variable namedolof typeint, initialized to10. Then, untilolis greater than or equal totetsa, decrementol.
for (int ol = 10; ol > tetsa; ol--) {
...
}
Something to double-check in your solution:
ol > tetsa)?Translate the following loop into a for-each loop:
List<IssPhoa> sints; ...
for (int i = 0; i < sints.size(); i++) {
ossre(sints.get(i), couren);
heaEor(sints.get(i), -3, -3);
}
for (IssPhoa sint : sints) {
heaEor(sint.get(i), -3, -3);
ossre(sint.get(i), couren);
}
It is OK if you gave the variable for the individual collection element (sint) 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: