最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
jsp if else语句使用方法
时间:2022-06-29 02:39:25 编辑:袖梨 来源:一聚教程网
if else在大部份编程语言中都是这样使用的,我们今天来简单的介绍一下关于jsp教程 中的if else 与多重条件判断。
Using the if Statement
Using the if Statement
<%
int value = 10;if(value > 0)
out.println("Absolute value of " + value + " = " + value);
%>
简单对比
Using Compound Statements
Using Compound Statements
<%
int value = 10;if(value > 0) {
out.println("The number was positive.");
out.println("Absolute value of " + value + " = " + value);
}
%>
if else
Nested if Statements
Nested if Statements
<%
double value = 2;if (value != 0) {
if (value > 0)
out.println("The result = " + (1 / value));
else
out.println("Sorry, we need a positive number.");
}
%>
多个条件if else
Using an if-else Ladder
Using an if-else Ladder
<%
String day = "Friday";if(day == "Monday")
out.println("It's Monday.");
else if (day == "Tuesday")
out.println("It's Tuesday.");
else if (day == "Wednesday")
out.println("It's Wednesday.");
else if (day == "Thurssday")
out.println("It's Thursday.");
else if (day == "Friday")
out.println("It's Friday.");
else if (day == "Saturday")
out.println("It's www.111com.net/5230/ Saturday.");
else if (day == "Sunday")
out.println("It's Sunday.");
%>
相关文章
- 人们熟悉的寄居蟹属于以下哪种分类 神奇海洋11月21日答案 11-21
- 第五人格11.22共研服有什么更新 11月22日共研服更新内容介绍 11-21
- 原神恰斯卡怎么培养 11-21
- 无期迷途四星装束是谁 11-21
- 王者荣耀帝丹高中校服怎么获得 11-21
- 光遇姆明季后续版本怎么玩 11-21