Looping
Looping provides the ability to perform a task one or more times until a larger task is complete. This is a reoccurring theme in development. Tasks such as computing the total payroll for a division within a company require looping through each employee's salary information and summing the total value. Rather than hard-coding the necessary statements for N number of employees, a loop can be used to process each employee until all employee salary information has been processed.
C# offers various looping constructs that can be used to perform repetitive tasks. Each has benefits and a time and place for its use. There is no such thing as one-size-fits-all, and this is the reason why there are so many ways to accomplish a particular task. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access