Results 1 to 2 of 2

Why are arrays usually processed with for loop?

This is a discussion on Why are arrays usually processed with for loop? within the Programming forums, part of the Web Designing & Development category; Arrays comes from their facility of using an index variable to traverse the array, accessing each element with the same ...

  1. #1
    Senior Member chinmay.sahoo's Avatar
    Join Date
    Dec 2013
    Location
    Banglore
    Posts
    266

    Thumbs up Why are arrays usually processed with for loop?

    Arrays comes from their facility of using an index variable to traverse the array, accessing each element with the same expression a[i]. All the is needed to make this work is a iterated statement in which the variable i serves as a counter, incrementing from 0 to a.length -1. That is exactly what a loop does.

  2. #2
    Senior Member charlottegracie's Avatar
    Join Date
    Jan 2017
    Posts
    207

    Default Re: Why are arrays usually processed with for loop?

    The real power of arrays comes from their facility of using an index variable to traverse the array, accessing each element with the same expression a[i]. All the is needed to make this work is a iterated statement in which the variable i serves as a counter, incrementing from 0 to a.length -1.