Page 38 - PowerPoint Presentation
P. 38

Loop Through an Array with For-Each






          •      There is also a "for-each" loop, which is used exclusively to loop through




                 elements in arrays:











          •      The following example outputs all elements in the cars array, using a "for-



                 each" loop :










                                                                                                                                      38
   33   34   35   36   37   38   39   40   41   42   43