📅  最后修改于: 2020-11-04 04:21:57             🧑  作者: Mango
在编写程序时,可能需要从一组给定路径中采用一个。在这种情况下,您需要使用条件语句,以使程序能够做出正确的决定并执行正确的操作。
Solidity支持条件语句,这些条件语句用于根据不同的条件执行不同的操作。在这里,我们将解释if..else语句。
以下流程图显示了if-else语句的工作方式。
Solidity支持以下形式的if..else语句-
Sr.No | Statements & Description |
---|---|
1 | if statement
The if statement is the fundamental control statement that allows Solidity to make decisions and execute statements conditionally. |
2 | if…else statement
The ‘if…else’ statement is the next form of control statement that allows Solidity to execute statements in a more controlled way. |
3 | if…else if… statement.
The if…else if… statement is an advanced form of if…else that allows Solidity to make a correct decision out of several conditions. |