JavaScript Tutorial/Statement/Do While
Содержание
do...while
do...while loop always executes the loop once before evaluating the expression for the first time.
This difference is seen in the following format:
<source lang="javascript">
do
{ statement; } while (expression);</source>
Do While loop
<source lang="javascript">
<html> <head> <title>A Simple Page</title> <script language="JavaScript">
</script> </head> <body> </body> </html></source>
Use do-while loop and prompt dialog to read user input
<source lang="javascript">
<html> <head> <title>A Simple Page</title> <script language="JavaScript">
</script> </head> <body> </body> </html></source>
Use integer variable to control a do-while loop
<source lang="javascript">
<html> <head> <title>A Simple Page</title> <script language="JavaScript">
</script> </head> <body> </body> </html></source>
Use or (||) in do-while condition
<source lang="javascript">
<html> <head> <title>A Simple Page</title> <script language="JavaScript">
</script> </head> <body> </body> </html></source>