Enhanced for loop is only in java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Enhanced for loop is only in java?

Actually I heard about it first time in my life :)

1st Aug 2019, 3:04 AM
Muhammad Osama Ahmed
Muhammad Osama Ahmed - avatar
6 Answers
+ 5
No There is enhanced for loop in JS too(for of, for Each, for in).
1st Aug 2019, 6:30 AM
$hardul B
$hardul B - avatar
+ 6
Several languages have similar loops.
1st Aug 2019, 7:08 AM
Sonic
Sonic - avatar
+ 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.
1st Aug 2019, 11:52 AM
Muhammad Waqar Ali ( F-Name : Islamuddin)
+ 1
Thanks for answers
1st Aug 2019, 12:35 PM
Muhammad Osama Ahmed
Muhammad Osama Ahmed - avatar
+ 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.
1st Aug 2019, 9:42 PM
Mattias Ulmestrand
0
Can we use For Each Loop for a Normal Array Which is Not an Array Literal?
23rd Dec 2019, 3:38 PM
Osman Shams
Osman Shams - avatar