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

47 lines
798 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声明
---
## 介绍
如果/ Else是条件陈述其中取决于条件的真实性将执行不同的动作。
> **注意:**仅当条件具有多个操作语句时才需要`{}`括号。
## 如果声明
```
if (condition){
statement1;
statement2;
}
```
> **注意:** `else`语句是可选的。
>
> ## 如果/ Else声明
```
if (condition){
statement1;
statement2;
}
else{
statement3;
statement4;
}
```
## 如果/ Elseif / Else声明
```
if (condition){
statement1;
statement2;
}
elseif{
statement3;
statement4;
}
else
statement5;
```
有关更多信息,请查看以下链接: [PHP Else](http://php.net/manual/en/control-structures.elseif.php)