by Ruth Hayton
by Ruth Hayton

This is mastery 20. Today I will write about the use of loops with “for”. There are many kind of ways to do loops; “While” “Do, While” and “for”, all have the same function in c++. Their main difference is probably the syntax, so I’ll show you the syntax for this type:

for (variable initialization; condition; variable update) {

Instructions to execute while the condition is true;

}

Here’s an example of code with a loop using “for”:

https://github.com/mferflores/for-loop/blob/master/Power-%20%22for%22%20loop

And now, here’s a poster done by myself for you to remember this topic:

%22For%22loops

CC BY 4.0 Loops with “for” by Mferflores is licensed under a Creative Commons Attribution 4.0 International License.