JSP Break Statement:
The break keyword is used to stop the entire loop. The break
keyword must be used inside any loop or a switch statement.
The break keyword will stop the execution of the innermost loop and
start executing the next line of code after the block.
Example:
JSP File (break.jsp)
<!DOCTYPE html>
<html>
<head>
<title>Nirajanghimireyworkshop.blogspot.com</title>
<meta charset="UTF-8"/>
</head>
<body>
<h2>this is an example of break</h2>
<%
int x = 1;
while (x>0) {
if(x==5){
out.println("Example of break");
break;
}
out.println("X = " + x + "<br/>");
x++;
}
%>
</body>
</html>
No comments:
Post a Comment