Files
freeCodeCamp/client/src/pages/guide/english/csharp/if-else-statement/index.md

30 lines
445 B
Markdown
Raw Normal View History

---
title: If Else Statement
---
# If Else Statement
The If-Else statement executes a block of code depending if your precondition is fullfilled or not.
## Example
```
int Price = 30;
If (Price = 30)
{
Console.WriteLine("Price is equal to 30.");
}
Else
{
Console.WriteLine("Price is not equal to 30.");
}
```
Since we already declared our int Price to be 30, this will be the expected output.
## Output
```
Price is equal to 30.
```