In C#, there are several constructs that can be used to repeat a block of code, including:
do
and while
are logically-controlled loop constructs, for
is counter-controller, and finally foreach…in
is used together for iteration based on data structures (specifically, those that implement IEnumerable<T>
)
User-located loop control mechanisms are achieved using jump statements, some of which include (Docs, 2015):
References
- Docs, M. (2015, July 20). Iteration Statements (C# Reference). Retrieved from https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/iteration-statements
- Docs, M. (2015, July 20). Jump Statements (C# Reference). Retrieved from https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/jump-statements