Programming C# 6, Part 07 of 12: Conditions and Looping
Interactive

Programming C# 6, Part 07 of 12: Conditions and Looping

LearnNow Online
Updated Aug 22, 2018

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.

Each LearnNowOnline training course is made up of Modules (typically an hour in length). Within each module there are Topics (typically 15-30 minutes each) and Subtopics (typically 2-5 minutes each). There is a Post Exam for each Module that must be passed with a score of 70% or higher to successfully and fully complete the course.


Prerequisites

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.

Video Runtime

94 Minutes

Time to complete

349 Minutes

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)