Files
freeCodeCamp/guide/chinese/csharp/if-else-statement/index.md
2018-10-16 21:32:40 +05:30

40 lines
643 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: If Else Statement
localeTitle: 如果是其他声明
---
# 如果是其他声明
If-Else语句根据您的前提条件是否已满执行代码块。
## 例
```
if(boolean expression)
{
// execute this code block if expression evalutes to true
}
else
{
// always execute this code block when above if expression is false
}
int Price = 30;
If (Price = 30)
{
Console.WriteLine("Price is equal to 30.");
}
Else
{
Console.WriteLine("Price is not equal to 30.");
}
```
由于我们已经宣布我们的int Price为30这将是预期的产出。
## 产量
```
Price is equal to 30.
```