IF Else Statement in C#

Hi Guy’s , Here is the article for if else statement in c# programming. An if statement identifies which statement to run based on the value of a Boolean expression. if else statement check condition first . if condition true then if part of block execute . if condition false then else part of block run. Let’s see the Syntax

syntax : –
if (Condition)
{
if block statement;
}
else
{
else block statement
}

if statement without an else
syntax : –
if (Condition)
{
if block statement;
}

Example 1 :

Example 2 :

Example 3 : –

Example 4 : –

Happy Coding…Thanks.

Post Author: adama