From 9c5c1412313dff793491a8f61599c6c71c3cc07b Mon Sep 17 00:00:00 2001 From: Louis Date: Thu, 5 Oct 2023 09:31:24 +0200 Subject: [PATCH] vault backup: 2023-10-05 09:31:24 --- Prog/Loops.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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