Check out example codes for "range based for loop c++". It will help you in understanding the concepts better.

Code Example 1

array<int, 5> values = {1, 2, 3, 4, 10};
// the type declaration below must be consistent with the array type
for (int x : values){ //we use a colon instead of in
cout << x << endl;
}

Code Example 2

for (<variable_declaration> : expression){
//statements
}

Learn ReactJs, React Native from akashmittal.com