📜  R-决策

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


决策结构要求程序员指定一个或多个要由程序评估或测试的条件,以及确定该条件为true时要执行的一个或多个语句,以及指定该条件时要执行的其他语句。确定为

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

做决定

R提供以下类型的决策声明。单击以下链接以查看其详细信息。

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 statement can be followed by an optional else statement, which executes when the Boolean expression is false.

3 switch statement

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