JavaScript foreach
var colors = ['red', 'blue', 'green'];
colors.forEach(function(color) {
console.log(color);
});
Grepper
var colors = ['red', 'blue', 'green'];
colors.forEach(function(color) {
console.log(color);
});
List<String> someList = new ArrayList<String>();
// add "monkey", "donkey", "skeleton key" to someList
for (String item : someList) {
System.out.println(item);
}
for (String name : names) {
System.out.println(name);
}
for (String item : someList) {
System.out.println(item);
}
for (String item : someList) {
System.out.println(item);
}
for (int i=0; i<arr.length; i++)
{
type var = arr[i];
statements using var;
}