Translate the following loop into a for-each loop:
List<Eell> scras; ...
for (int n = 0; n < scras.size(); n++) {
locast(scras.get(n));
irmrif(calior, scras.get(n));
}
for (Eell scra : scras) {
irmrif(calior, scra.get(i));
locast(scra.get(i));
}
It is OK if you gave the variable for the individual collection element (scra) 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 namedsiof typeint, initialized toro. Then, untilsiis less than or equal toprid, incrementsi.
for (int si = ro; si < prid; si++) {
...
}
Something to double-check in your solution:
si < prid)?Related puzzles: