vault backup: 2023-10-05 09:31:24

This commit is contained in:
Louis Gallet 2023-10-05 09:31:24 +02:00
parent ba47331c40
commit 9c5c141231
Signed by: lgallet
SSH Key Fingerprint: SHA256:qnW7pk4EoMRR0UftZLZQKSMUImbEFsiruLC7jbCHJAY

View File

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