This is the eighth in a series of computer science lessons about programming with C# for beginners. In this lesson you will learn about an iteration construct known as the for loop. Iteration constructs, also known as looping constructs, allow you to repeat a block of instructions over and over again, until a condition is met. Iterative code is essential for writing many standard sorting and searching algorithms, and for manipulating data structures and files. You will learn about the compact syntax of a for loop, and why a for loop is often referred to as a count controlled loop. You will learn how a for loop can count up, or down, by means of a variable with block level scope. You will also learn how a for loop can be used, in conjunction with the Substring method, to scan a string of text and display one letter at a time, or even search a string to see if it contains a particular letter.
Chapters:
00:00 Introduction
00:45 A simple for loop
02:03 Count down
02:45 Scan a string with the Substring method
05:10 Block level scope versus procedure level scope
06:16 Exercise – Search a string
06:46 Solution