vault backup: 2023-10-05 09:31:24
This commit is contained in:
parent
ba47331c40
commit
9c5c141231
@ -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 (<condition>)
|
||||
@ -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]
|
||||
}
|
||||
```
|
Loading…
x
Reference in New Issue
Block a user