.


:




:

































 

 

 

 


while




, . , .

. while , for. - , - . - , - . - , - .

, , .

While , . , , .

:

while () {}

: 1 10. :

for i . while , .

. , .

, if , . .

.

. while , , , .

: while, for.

, <tr>.

var i = 2, j; /* . , FOR.*/ document.write(" <table border='1' cellspacing='0' cellpadding='2' align='center'> ") while (i <= 10) { document.write(" <tr> ") // // . document.write(" </tr> ") i++ } document.write(" </table> ")

for:

var i = 2, j; document.write(" <table border='1' cellspacing='0' cellpadding='2' align='center'> ") while (i <= 10) { document.write(" <tr> ") for (j = 2; j < 10; j++) {document.write(" <td> " + j + " &times; " + i + " = " + (i * j) + " </td> ")} document.write(" </tr> ") i++ } document.write(" </table> ")

while. , , . .

var i = 2, j = 2; document.write(" <table border='1' cellspacing='0' cellpadding='2' align='center'> ") while (i <= 10) { document.write(" </tr> ") while (j < 10) {document.write(" <td> " + j + " &times; " + i + " = " + (i * j) + " </td> ") j++ } document.write(" </tr> ") i++ } document.write(" </table> ")

. - . <tr>. , .

: j ?

: 10.

: ?

: 2, .

: ?..

.

break, switch. ( ). , . ( ).

. . . , . , . , , k, j ? , .

, (k) , 10, j :

var i = 2, j = 2, k; document.write(" <table border='1' cellspacing='0' cellpadding='2' align='center'> ") while (i <= 10) { document.write(" <tr> ") k = j while (k < 10) {document.write(" <td> " + k + " &times; " + i + " = " + (i * k) + " </td> ") k++ } document.write(" </tr> ") i++ } document.write(" </table> ")

: , -, for. , while.





:


: 2015-10-01; !; : 263 |


:

:

, , .
==> ...

1839 - | 1510 -


© 2015-2024 lektsii.org - -

: 0.008 .