Programming C# 6, (Part 7 of 12): Conditions and Looping
Interactive

Programming C# 6, (Part 7 of 12): Conditions and Looping

Biz Library
Updated Feb 04, 2020

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.


Lesson 1:

  • Conditional Branching
  • Simple If Statements
  • Demo: If Statements
  • Demo: If Else
  • Demo: Nested If
  • Demo: Multiple Conditions
  • Demo: Conditional Operator.

Lesson 2:

  • Demo: Switch Statement
  • Demo: Switch Statement Cases.

Lesson 3:

  • Unbounded Looping
  • The While Loop
  • Demo: While Loop
  • Demo: While Loop Cont.
  • The Do-While Loop
  • Demo: Do-While Loop.

Lesson 4:

  • The For Loop
  • Demo: For Loop
  • For Loop Syntax
  • Demo: For Loop Syntax
  • Demo: Nested For Loops
  • Using Loops with Collections
  • Demo: Looping Collections
  • The Foreach Loop
  • Demo: Foreach Loop
  • Why For Loops for Collections?.

Lesson 5:

  • Demo: Break
  • Demo: Goto
  • Demo: Without Goto
  • goto Limitations
  • Demo: Continue.