0

Enhanced for loop

I can't understand about enhanced for loop About its idea

21st May 2019, 1:44 PM
rahul
2 Antworten
+ 2
If you are working with arrays and collections, you can use alternative syntax of for loop (enhanced form of for loop) to iterate through items of  arrays/collections. It is also referred as for-each loop because the loop iterates through each element of array/collection.
21st May 2019, 1:58 PM
Somya Sarathi Samal
Somya Sarathi Samal - avatar
+ 1
In which language? Basically it iterates inside a collection (array, list etc) and usually performs tasks on it. Basic foreach in c# int[] arrayX = {1,4,5,12}; foreach (int x in arrayX) { Console.WriteLine(x); } Each value inside the arrayX collection will get 1) stored inside x 2) printed using writeline
21st May 2019, 1:59 PM
HNNX 🐿
HNNX 🐿 - avatar