ASP.NET Basics, Part 4: Looping the Loop
(Page 1 of 7 )
Last time, I introduced you to C#'s "if-else" family of conditional statements and explained how they could be used in combination with comparison and logical operators to control program flow and execution... This week, I'm going to proceed a little further down the road, with a look at the different types of loops supported by C# (and, by extension, ASP.NET).Last time, I introduced you to C#'s "if-else" family of conditional statements and explained how they could be used in combination with comparison and logical operators to control program flow and execution. I also explained how conditional statements could be nested within one another, and wrapped things up with a discussion of the "switch" conditional statement.
This week, I'm going to proceed a little further down the road, with a look at the different types of loops supported by C# (and, by extension, ASP.NET). As always, I'll begin with a definition for those of you coming at this series from a non-programming background. In geek-talk, a "loop" is precisely what you would think - a programming construct that allows you to execute a set of statements over and over again, until a pre-defined condition is met.
C# offers a wide range of loops, in keeping with its profile as a next-generation programming language. It has the "while" and "do-while" loops, for situations involving a variable number of loop iterations, as well as the traditional "for" loop for loops involving a pre-defined number of iterations. Over the next few pages, I'll explain these loops in greater detail, together with examples and illustrations of how they can be used.
Every programming language worth its salt uses loops, and, incidentally, so do many shampoo manufacturers. Think lather-rinse-repeat, and you'll see what I mean.
Next: Counting Down >>
More ASP.NET Articles
More By Harish Kamath (c) Melonfire