freeCodeCamp/guide/chinese/csharp/if-else-statement/index.md

40 lines
643 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
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.
```