C# - TPL2141 logo C# - TPL2141

In C#, there are several constructs that can be used to repeat a block of code, including:

  1. while
  2. do…while
  3. for
  4. foreach…in

(Docs, 2015)

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):

  1. break
  2. continue
  3. goto

References

  1. Docs, M. (2015, July 20). Iteration Statements (C# Reference). Retrieved from https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/iteration-statements
  2. Docs, M. (2015, July 20). Jump Statements (C# Reference). Retrieved from https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/jump-statements