+ 3
Enhanced for loop is only in java?
Actually I heard about it first time in my life :)
6 Antworten
+ 5
No
There is enhanced for loop in JS too(for of, for Each, for in).
+ 6
Several languages have similar loops.
+ 1
It like for loop simple but it's used for accessing values from collection and known iteration. Like in array. Iteration is known due the the size.
+ 1
Thanks for answers
+ 1
As mentioned in other comments, similar loops are available in multiple languages. More generally called "for each"-loops.
For example, there's a variant which is easily implemented in Python, it's actually the standard for loop there. I've recently picked Python up, and it's a pretty user friendly language. A little bit different from Java, but simpler in a few aspects in my opinion. You may want to check it out, the course here is helpful.
0
Can we use For Each Loop for a Normal Array Which is Not an Array Literal?