Conditionals

Use conditional statements in C# programs.

The if-else statement

Conditional statements are a basic component of many programming languages. They control program flow, depending on given conditions.

Consider the following scenario. We want to build a program that determines whether a user is an adult by checking their age. If the user is 18 or older, then they’re an adult.