JavaScript DHTML/Language Basics/continue
Версия от 09:59, 26 мая 2010; (обсуждение)
Содержание
Continue in while loop
<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
var x = 0;
while (x < 10)
{
x++;
document.write(x+"<BR>");
continue;
alert("You never see this!");
}
</script>
</head>
<body>
</body>
</html>
Continue with condition
<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
var x = 0;
while (x < 10)
{
x++;
if (x == 5)
{
continue;
}
alert(x);
}
</script>
</head>
<body>
</body>
</html>
Continue with even numbers
<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
var x = 0;
while (x < 10)
{
x++;
if (x % 2 == 0)
{
continue;
}
alert(x);
}
</script>
</head>
<body>
</body>
</html>
Continue with odd numbers
<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
var x = 0;
while (x < 10)
{
x++;
if (x % 2 != 0)
{
continue;
}
alert(x);
}
</script>
</head>
<body>
</body>
</html>