0

Why the syntax of for(each) don't have square brakes (prime[]) to refer to prime array?

something like this!! for(int t: prime[]){ //statement }

8th Apr 2018, 11:06 PM
Santo Francisco Ramos Mejia
Santo Francisco Ramos Mejia - avatar
2 Answers
+ 2
If you can use a foreach loop on it, it must already be an array or the compiler will give you an error. Square brackets (after initialization) are used to retrieve values.
8th Apr 2018, 11:10 PM
Ariela
Ariela - avatar
0
thanks Ariela, I understand.
9th Apr 2018, 2:09 AM
Santo Francisco Ramos Mejia
Santo Francisco Ramos Mejia - avatar