Enhanced for loop vs foreach loop? | SoloLearn: Learn to code for FREE!

+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?

1/16/2019 8:15:02 AM

Chinedu Tabansi

2 Answers

New Answer

+2

With foreach you don't need to access the elements of an array with its index