📜  Dart编程-决策

📅  最后修改于: 2020-11-05 04:15:42             🧑  作者: Mango


条件/决策结构在执行指令之前先评估条件。

做决定

下表中对Dart中的条件构造进行了分类。

Sr.No Statement & Description
1 if statement

An if statement consists of a Boolean expression followed by one or more statements.

2 If…Else Statement

An if can be followed by an optional else block. The else block will execute if the Boolean expression tested by the if block evaluates to false.

3 else…if Ladder

The else…if ladder is useful to test multiple conditions. Following is the syntax of the same.

4 switch…case Statement

The switch statement evaluates an expression, matches the expression’s value to a case clause and executes the statements associated with that case.