Changes

Jump to: navigation, search

C Sharp Looping - The for Statement

15 bytes added, 19:06, 17 January 2008
no edit summary
In this chapter of [[C Sharp Essentials|C# Essentials]] we will continue looking at flow control in C# applications. In the preceding chapters we have looked in detail at using logical expressions to decide what C# code should be executed. Another aspect of flow control entails the definition of loops. Loops are essentially sequences of C# statements which are to be executed repeatedly until specified condition (or conditions) are met.
It is generally common knowledge that computers are great at performing repetitive tasks an infinite number of times, and doing so very quickly. It is also common knowledge that computers really don't do anything unless someone programs them to tell them what to do. Loop statements are the primary mechanism for telling a computer to perform the same task over and over again until a set of crieria criteria are met. This is where ''for'', ''while'' and ''do ... while'' loops are of use. This chapter is dedicated to the design of ''for'' loops in C#. The ''while'' and ''do ... while'' looping techniques will be covered in [[C Sharp Looping with do and while Statements|C# Looping with do and while Statements]].
=== The C# ''for'' Loop ===

Navigation menu