+ 1

Enhanced for loop vs foreach loop?

I was in AP computers today and we learned about the foreach loop. When I saw it I instantly thought it was the enhanced for loop. They seem to have the same syntax. What's the difference?

16th Jan 2019, 8:15 AM
Chinedu Tabansi
Chinedu Tabansi - avatar
1 Réponse
+ 1
With foreach you don't need to access the elements of an array with its index
16th Jan 2019, 11:19 AM
Gordon
Gordon - avatar