C# Programming: Lesson 7. While Loops
YouTube Viewers YouTube Viewers
205K subscribers
1,310 views
0

 Published On Jul 2, 2023

This is the seventh 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 while 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 a variation of the while loop, the so called do loop, and you will see why these constructs are often referred to as condition controlled loops. You will also learn how to write an infinite loop, and how to force it to stop by using the break command. In addition, you will meet the StreamReader object, which can be used to read from a text file one line at a time. You will also see how a message box can be used to collect input from a user.

Chapters:
00:00 Introduction
01:10 A simple while loop
03:40 Do loop
05:03 Read from a text file with a StreamReader
08:55 Condition controlled versus count controlled loops
10:41 Infinite loops
12:29 Collect input with MessageBox
14:16 Exercises
15:01 Solutions

show more

Share/Embed