+ Start a Discussion
James L.James L. 

For "each" loop follows the order as for (integer i=0; i< xx, i++) ?

Integer[] arr = new Integer[] {3, 31,6,9};

 

loop 1

for (Integer tmp: arr) {

 

}

 

lopp2

for (Integer i=0; i < arr.size();i++) {

    Integer tmp = arr[i]

}

 

Will those 2 loop follow the same order when iterating the array ?

 

 

Best Answer chosen by Admin (Salesforce Developers) 
logontokartiklogontokartik

Yes. when you define an array in that format, its nothing but a list collection, which is ordered.