How Two Iterate Over Two Arrays In A Strongly Typed Language?
I have had this question in many languages, but I never happened to pursue the question. I only googled the questions, but rarely got results.

I figured it out, but I just wanna make sure this is the best way to go.

Lets take an Example: (i'll make it as general as possible so that it hopefully works in every language.)


    firstArray[0] = 1;
    firstArray[1] = 2;
    firstArray[2] = 3;

    secondArray[0] = a;
    secondArray[1] = b;
    secondArray[2] = c;

Now lets imagine if both these arrays are endless.

If I wanted to get these results:

    1a
    2b
    3c

Then can I write this?:

    for (int i=0; i < 3; i++)
    {
    print(firstArray[i] + secondArray[i]
    }





How Two Iterate Over Two Arrays In A Strongly Typed Language?
===

I have had this question in many languages, but I never happened to pursue the question. I only googled the questions, but rarely got results.

I figured it out, but I just wanna make sure this is the best way to go.

Lets take an Example: (i'll make it as general as possible so that it hopefully works in every language.)


    firstArray[0] = 1;
    firstArray[1] = 2;
    firstArray[2] = 3;

    secondArray[0] = a;
    secondArray[1] = b;
    secondArray[2] = c;

Now lets imagine if both these arrays are endless.

If I wanted to get these results:

    1a
    2b
    3c

Then can I write this?:

    for (int i=0; i < 3; i++)
    {
    print(firstArray[i] + secondArray[i]
    }




