Translate the following natural language description of a loop into a for loop:
Declare a variable namedciof typeint, initialized toen. Then, untilciis not equal torass, decrementci.
for (int ci = en; ci != rass; ci--) {
...
}
Something to double-check in your solution:
ci != rass)?Translate the following loop into a for-each loop:
List<Cardse> isses; ...
for (int i = 0; i < isses.size(); i++) {
rorSman(isses.get(i), 0);
licva(-2);
oorBenphe(isses.get(i));
}
for (Cardse iss : isses) {
oorBenphe(iss.get(i));
licva(-2);
rorSman(iss.get(i), 0);
}
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.
Related puzzles: