diff --git a/Prog/Loops.md b/Prog/Loops.md index f8965e4..7a978ba 100644 --- a/Prog/Loops.md +++ b/Prog/Loops.md @@ -2,6 +2,7 @@ In C#, loops are called iteration statements. We need to master both, recursion - while and do (...) while - for - foreach +> For the rest of the document, something between `<>`is something mandatory and something between `[]`is something optionnal ## While loop ```cs while () @@ -64,3 +65,17 @@ uint SumFor(uint n) return res; } ``` +**Comparaison with the while loop** +```cs +for ([initialize]; [condition]; [iterator]) +{ + // Repeat stuff +} + +[initializer] +while ([condition]) +{ + // Repeat stuff + [iterator] +} +``` \ No newline at end of file