Learn your way! Get started

Programming C# 6, Part 07: Conditions and Looping

with expert Don Kiely

Watch trailer

Programming C# 6, Part 07: Conditions and Looping Trailer

Course at a glance

Included in these subscriptions:

  • Dev & IT Pro Video
  • Dev & IT Pro Power Pack
  • Power Pack Plus

Release date Release date 2/11/2016
Level Level Intermediate
Runtime Runtime 1h 34m
Platform Platform Major browsers on Windows Major browsers on Windows Major browsers on Mac OSX Major browsers on Mac OSX Mobile Devices Mobile Devices
Closed captioning Closed captioning Included
Transcript Transcript Included
eBooks / courseware eBooks / courseware Included
Hands-on labs Hands-on labs Included
Sample code Sample code Included
Exams Exams Included

Enterprise Solutions
Enterprise Solutions

Need reporting, custom learning tracks, or SCORM? Learn More

Course description

C# provides a number of methods for making decisions as code executes. You can branch execution of your code based on conditions you define—anything from a simple check on the value of a variable to the value of a complex expression that you create—with if and switch statements. Another common technique is to execute one block of code over and over again until some condition is met, which can be accomplished with the various kinds of loops provided by C#. Finally, C# supports jumping to locations in code outside of the normal sequential order of statements. You’ll even learn some narrow and specific uses for the much-maligned goto operator.


This course builds upon: Programming C# 6: Getting started, Your First App, Projects and Syntax and Variables and Data Types.

Meet the expert

Don Kiely Don Kiely is a featured instructor on many of our SQL Server and Visual Studio courses. He is a nationally recognized author, instructor, and consultant specializing in Microsoft technologies. Don has many years of teaching experience, is the author or co-author of several programming books, and has spoken at many industry conferences and user groups. In addition, Don is a consultant for a variety of companies that develop distributed applications for public and private organizations.

Course outline

Conditionals & Looping

Conditional Branching (25:38)
  • Introduction (00:42)
  • Conditional Branching (00:46)
  • Simple If Statements (00:26)
  • Demo: If Statements (04:49)
  • Demo: If Else (04:11)
  • Demo: Nested If (03:39)
  • Demo: Multiple Conditions (04:23)
  • Demo: Conditional Operator (06:01)
  • Summary (00:37)
Switch Statements (13:29)
  • Introduction (00:35)
  • Demo: Switch Statement (06:07)
  • Demo: Switch Statement Cases (06:08)
  • Summary (00:37)
Repeating Code Blocks (15:40)
  • Introduction (00:45)
  • Unbounded Looping (00:14)
  • The While Loop (00:49)
  • Demo: While Loop (04:40)
  • Demo: While Loop Cont. (03:26)
  • The Do-While Loop (00:51)
  • Demo: Do-While Loop (04:21)
  • Summary (00:30)
Controlled Looping (24:43)
  • Introduction (00:28)
  • The For Loop (01:17)
  • Demo: For Loop (01:56)
  • For Loop Syntax (02:55)
  • Demo: For Loop Syntax (03:42)
  • Demo: Nested For Loops (03:23)
  • Using Loops with Collections (00:40)
  • Demo: Looping Collections (05:55)
  • The Foreach Loop (00:37)
  • Demo: Foreach Loop (01:24)
  • Why For Loops for Collections? (01:48)
  • Summary (00:33)
Unconditional Branching (14:40)
  • Introduction (00:31)
  • Demo: Break (01:22)
  • Demo: Goto (04:44)
  • Demo: Without Goto (02:19)
  • goto Limitations (01:48)
  • Demo: Continue (03:09)
  • Summary (00:44)