C Sharp for Beginners/Making Decisions
If Statement:
editThe if statement in c# is so simple like other languages. The syntax for if statement is:
if(condition){
// Statements
}
Here is condition we can check some expression for true or false. For example 5 > 4 is true but 4 > 5 is false.
if(5 > 4){
Console.WriteLine("Yes five is still greater than 4");
}
Else part:
editIn the else part if if condition we can give statements which will execute if condition is false.
if(5 > 4){
Console.WriteLine("Yes five is still greater than four");
} else {
Console.WriteLine("Oh No! five is now no longer greater than four");
}