📜  Pascal-决策

📅  最后修改于: 2020-11-03 16:14:00             🧑  作者: Mango


决策结构要求程序员指定一个或多个要由程序评估或测试的条件,以及确定条件为真的情况下要执行的一条或多条语句,以及如果条件被确定为可选的其他执行语句确定为假。

以下是大多数编程语言中常见的典型决策结构的一般形式-

Pascal的决策声明

Pascal编程语言提供以下类型的决策声明。单击以下链接以查看其详细信息。

Sr.No Statement & Description
1 if – then statement

An if – then statement consists of a boolean expression followed by one or more statements.

2 If-then-else statement

An if – then statement can be followed by an optional else statement, which executes when the boolean expression is false.

3 nested if statements

You can use one if or else if statement inside another if or else if statement(s).

4 case statement

A case statement allows a variable to be tested for equality against a list of values.

5 case – else statement

It is similar to the if-then-else statement. Here, an else term follows the case statement.

6 nested case statements

You can use one case statement inside another case statement(s).