Contents

keyboard_tab
C# Conditional Branching
1
Introduction
PREVIEW1m 32s
2
Overview
PREVIEW1m 12s
7
Summary
2m 15s

The course is part of this learning path

Overview
Overview
Difficulty
Beginner
Duration
20m
Students
36
Ratings
5/5
starstarstarstarstar
Description

 

The ability for software to perform tasks or functions based on the state of variables or data is intrinsic to programming. In plain language, that means responding appropriately to input from the user or some data feed. C# Conditional Branching primarily focuses on If and Switch statements, the main mechanisms for executing or branching to different code depending on whether a condition is true or false. A simple example is allowing users to log in if their username and password match those stored in the software.

Learning Objectives

  • Learn and understand If-statement syntax and how to use it in different scenarios
  • Learn and understand the Switch statement and how to use it 
  • Learn about evaluating multiple Boolean conditions
  • See how the dotnet new command has changed with the release of .NET 6.0 and C# 10

Intended Audience

This course is intended for students that are relatively new to programming but not absolute beginners and want to know how to make their software responsive and adaptive. Students should know the basics of a C# programs structure and have experience running a program within their development environment. While for-loops and object-oriented concepts will be mentioned in the course, in-depth knowledge of these topics isn't essential.

Prerequisites

Demo Source Code

https://github.com/cloudacademy/csharp-conditional-branch

Transcript

 When I say conditional branching is a cornerstone of programming, it's really a cornerstone of life and not even sentient life. A moth makes decisions about which light source to fly to. A mosquito evaluates which outdoor diner to bite based on scent and heat. A shopper chooses an item based on several well-defined and some not well-defined criteria. These situations have different choice scenarios, ranging from a simple binary decision that selects from one or two outcomes to evaluating multiple criteria to select from many actions or choices. C#, like other programming languages, has the if-statement and its variants, assisting developers in writing dynamic and adaptive code. 

I'll start slightly off-topic by looking at how the dotnet new command has changed under .NET 6 and C# version 10 when creating a new app from the console. Then we'll get into if-statements, followed by Boolean expressions, and finish with the switch statement.

About the Author
Students
20941
Courses
50
Learning Paths
9

Hallam is a software architect with over 20 years experience across a wide range of industries. He began his software career as a  Delphi/Interbase disciple but changed his allegiance to Microsoft with its deep and broad ecosystem. While Hallam has designed and crafted custom software utilizing web, mobile and desktop technologies, good quality reliable data is the key to a successful solution. The challenge of quickly turning data into useful information for digestion by humans and machines has led Hallam to specialize in database design and process automation. Showing customers how leverage new technology to change and improve their business processes is one of the key drivers keeping Hallam coming back to the keyboard. 

Covered Topics