Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

Microsoft

Add logic to C# console applications (Get started with C#, Part 3)

Microsoft via Microsoft Learn

Overview

  • Module 1: Learn the operators and techniques required to evaluate and compare values in your decision statements.
  • In this module, you will:

    • Use operators to create Boolean expressions that test for comparison and equality.
    • Use built-in methods to the string class to perform better evaluations on strings.
    • Use the negation operator to test for the opposite of a given condition.
    • Use the conditional operator to perform an inline evaluation.
  • Module 2: Use code blocks with more confidence, understanding how they impact the visibility and accessibility of both higher and lower-level constructs in your code.
  • In this module, you will:

    • Understand the impact of declaring and initializing variables inside and outside of code blocks.
    • Remove code blocks in if statements when there's only one line of code in the body of the code block to improve readability.
    • Identify namespaces, classes, and methods in your code.
    • Understand how moving methods into new classes, and classes into new namespaces impacts the visibility of the code.
    • Understand the use of the using statement to instruct the compiler where to look for classes referenced in your code.
  • Module 3: Learn how to add branching logic that matches one variable or expression against many possible values.
  • In this module, you will:

    • Use the switch-case construct to match a variable or expression against several possible outcomes.
    • Convert code that uses an if-elseif-else construct into a switch-case construct.
  • Module 4: Use the `for` iteration statement to loop a pre-set number of times and control the iteration process.
  • In this module, you will:

    • Use the for statement to loop through a block of code.
    • Modify how the .NET Runtime executes the looping logic, changing the value of the iterator, the condition and the pattern.
  • Module 5: Use the `do-while` and `while` statements to iterate as long as a Boolean expression evaluates to true.
  • In this module, you will:

    • Write code that uses the do-while statement to iterate through a code block.
    • Write code that uses the while statement to iterate through a code block.
    • Use the continue statement to step directly to the Boolean evaluation.

Syllabus

  • Module 1: Evaluate Boolean expressions to make decisions in C#
    • Introduction
    • Exercise - Boolean Expressions
    • Exercise - conditional operator
    • Challenge
    • Solution
    • Challenge
    • Solution
    • Knowledge Check
    • Summary
  • Module 2: Control variable scope and logic using code blocks in C#
    • Introduction
    • Exercise - Code blocks and variable scope
    • Code blocks define methods, classes, and namespaces
    • Exercise - Remove code blocks in if statements
    • Challenge
    • Solution
    • Knowledge Check
    • Summary
  • Module 3: Branch the flow of code using the switch-case construct in C#
    • Introduction
    • Exercise - Use the switch case statement
    • Challenge
    • Solution
    • Knowledge check
    • Summary
  • Module 4: Iterate through a code block using for statement in C#
    • Introduction
    • Exercise - for iteration statement
    • Challenge
    • Solution
    • Knowledge check
    • Summary
  • Module 5: Add looping logic to your code using the do-while and while statements in C#
    • Introduction
    • Exercise - do-while, while, and continue statements
    • Challenge
    • Solution
    • Knowledge check
    • Summary

Reviews

Start your review of Add logic to C# console applications (Get started with C#, Part 3)

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.