Foreach Loop
This is a compact version of the for loop. Mainly used for looping through arrays and collections.
Syntax
for(element : collection) {
// Code here runs for each element.
}
Example
String[] languages = {"Java", "C++", "C#", "JavaScript", "Elixir"};
for(String language : languages){
// will execute this for each of the language in the languages array
}