vault backup: 2023-10-05 09:18:23

This commit is contained in:
2023-10-05 09:18:23 +02:00
parent 31fa06ec3b
commit 37c662ef10
2 changed files with 33 additions and 8 deletions

25
Prog/Loops.md Normal file
View File

@ -0,0 +1,25 @@
In C#, loops are called iteration statements. We need to master both, recursion and loops. There are 3 kinds of loops in C# :
- while and do (...) while
- for
- foreach
## While loop
```cs
while (<condition>)
{
// repeat stuff
}
```
The ``condition`` is a boolean
**Example**
```cs
unit SumWhile(unit n)
{
uint loop = 0;
while (n > 1)
{
loop += 1;
n = n - 1;
}
return loop;
}
```