Here's the initialization condition is first set to a=10. The loop first checks for this condition. It then checks for the condition expression ie a<20whichholdstrueas10<20(forthefirstcase).Nowthebodyoftheloopisexecutedandwegettheoutput"Valueofa:10".Thentheupdateexpressionisexecutedwhichaddsthenumber1to'a'andthevalueof'a'getsupdatedto11andthesamestepsarefollowed(asabove)untilthevalueofvreacheslessthan20ie19.
# Range-based for-loop
C++ also has what we call range-based for loops which iterates through all the elements of a container(eg array).
## Syntax
```
for(element:container) 声明(S); }
int \[5\] array = {1,2,3,4,5} for(int i:array) cout <<i<<endl;}