1var colors = ['red', 'blue', 'green'];
2
3colors.forEach(function(color) {
4 console.log(color);
5});
1int [] intArray = { 10, 20, 30, 40, 50 };
2
3for( int value : intArray ) {
4 System.out.println( value );
5}
1//itemset contains variables of type <Data Type>
2for(<Data Type> item : itemset) {
3 //loop
4}
1List<String> someList = new ArrayList<String>();
2// add "monkey", "donkey", "skeleton key" to someList
3for (String item : someList) {
4 System.out.println(item);
5}
1// definition eine Datenstruktur, hier ein Array mit 9 Werten
2int[] array = new int[]{4, 8, 4, 2, 2, 1, 1, 5, 9};
3
4// ForEach Schleife
5for( int k: array )
6{
7 System.out.println("k = "+k);
8}
9