
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
What are decision making statements in C#?
Decision making statements requires the programmer to specify one or more conditions to be evaluated or tested by the program, along with a statement or statements to be executed if the condition is determined to be true, and optionally, other statements to be executed if the condition is determined to be false.
The following are the types of decision making statements −
Sr.No | Statement & Description |
---|---|
1 | if statement An if statement consists of a boolean expression followed by one or more statements. |
2 | if...else statement An if statement can be followed by an optional else statement, which executes when the boolean expression is false. |
3 | nested if statements You can use one if or else if statement inside another if or else if statement(s). |
4 | switch statement A switch statement allows a variable to be tested for equality against a list of values. |
5 | nested switch statements You can use one switch statement inside another switch statement(s). |
Let us see an example of if-else decision making statement in C#.
Example
using System; namespace Demo { class Program { static void Main(string[] args) { int a = 50; if (a < 10) { Console.WriteLine("a is less than 10"); } else { Console.WriteLine("a is not less than 10"); } Console.WriteLine("a = {0}", a); Console.ReadLine(); } } }
Output
a is not less than 10 a = 50
- Related Articles
- Decision Making in C++
- Decision Making in C#
- Decision Making in Java
- What Is Data-Driven Decision-Making?
- Group Decision Making
- What are the Three Levels of Capital Budgeting Decision-Making?
- Decision-Making in the Courtroom
- What is meant by Consumer Decision-Making?
- Factors Influencing Decision Making
- Theories of Decision Making
- What is Management Decision Making and its Types?
- Framework for Efficient Decision Making
- Emotion Laden Consumer Decision Making
- Adaptive Strategy Selection in Consumer Decision Making
- What is machine learning? How it is helpful for decision making?

Advertisements