Csharp Tutorial Road to a Finished System [If-Else Condition Statements]

Good Day everyone 😊, We are now here to our fourth C# programming tutorial
Today we are going to discuss about the Condition Statements
Condition Statements are statements that can be executed depending on a condition, These statements are often a block of codes which can be used to compare variables and/or its values.
Lets begin the tutorial, lets open the visual studio and create a console application project. Name the project "CSharp Conditioning Tutorials"
If you are new to this tutorial series opening and creating a console application project is linked here.

Output

On our source code we have declared variable answer with an assign value of true;
The next block of codes is our if condition statement (distinguish it using the red line).

- if is our main condition, like in the english language we have use this as making a comparison
- parenthesis "()" is where we are going to put our expression term or our algebraic expression
- answer is the variable that we are going to compare into a value
- double equal sign "==" let's don't be confused, when we are declaring a variable a single equal sign is used to ASSIGN a certain value but in a condition statement we use a double equal sign to CHECK the assigned value of the variable
We can use different operators in our condition statements here are some : "==" if the condition is equal it will return a value of true, false otherwise. The greater than and less than sign "<>" which litterally compares if the a value is greater than pr less than to the other. We also have the "!" sign which means NOT or NEGATE, we can add it to the other operators I have discussed. "!=" or NOT EQUAL will return a true value if the condition was not equal to the comparing value, "!<" or NOT LESS THAN returns a true value if the variable was less than to the comparing value and the "!>" or NOT GREATER THAN returns a true vlue if the variable is not greater than the comparing value
- next to the double equal sign is the value that we are comparing to our variable
- brackets "{ }" are used to enclose the condition statement, once the condition is satisfied all the statements inside the bracket will be executed, once it was not satisfied it just simply jump after the block
We have declared the variable answer with a value of true so it satisfies the condition statement and execute the codes inside the bracket.
We can use as many if condition statement we want inside our program like the example below

Now I want to you to think that you are asking a very beautiful girl to be her prom date in the upcoming ball, if her answer is yes (true) you'll gonna go to the ball with her, but if she'll answer a no (false) you will go to the ball alone. But we know girls, sometimes when we ask them a question they just stare at us and don't response at all so what are we going to do ? we cannot go with her in the ball as she didn't answer a yes, also we cannot go to the ball alone as she didn't say no

With this problem the else statement comes in, the else statement is a kind of statement where we can have a block to enter with whenever our condition(s) was not met. On our example with the "GIRL WITH NO RESPONSE 😂" we can set a statement if she didn't answer at all

There we go, our fourth tutorial about the C# programming language. Thank you for reading my tutorial for the day, hope you learn from me and you follow our program that deals in the if-else condition statement. Next tutorial will be dealing with the if-else-if condition statement and the nested if-else condition statement
Here is our previous tutorial in the series:
Csharp Tutorial Road to a Finished System [Introduction]
Csharp Tutorial Road to a Finished System [Hello World]
Csharp Tutorial Road to a Finished System [Data Types and Variables]
Special C# Tutorial with MongoDB:
Advance C# Programming with MongoDB

This post received a free Upvote. Get your free Upvote NOW! Just follow @upvoteforfree
Upvoted @steemian-sniper
Sorry for being my target for the day, but you was been picked in this vast sea
DISCLAIMER: I was a robot who was programmed to target my followers, the creator does not share ANY opinions and thoughts explained by the author
Also this article will now be resteemed by your's truly
Help us giving you bigger upvotes by:
Do the above and we'll have more STEEM POWER to give YOU bigger rewards next time!
To know me better click this link and you will be redirected
Chao !
@originalworks