File tree Expand file tree Collapse file tree 2 files changed +11
-10
lines changed
1-js/2-first-steps/15-while-for/1-loop-last-value Expand file tree Collapse file tree 2 files changed +11
-10
lines changed Original file line number Diff line number Diff line change 1- Ответ : ` 1 ` .
1+ The answer : ` 1 ` .
22
33``` js
44// + run
@@ -9,18 +9,19 @@ while (i) {
99}
1010```
1111
12- Каждое выполнение цикла уменьшает ` i ` . Проверка ` while(i) ` даст сигнал "стоп" при ` i = 0 ` .
12+ Every loop iteration decreases ` i ` by ` 1 ` . The check ` while(i) ` stops the loop when ` i = 0 ` .
1313
14- Соответственно, шаги цикла :
14+ Hence, the steps of the loop make the following sequence ("unrolled") :
1515
1616``` js
17- var i = 3
18- alert ( i-- ); // выведет 3, затем уменьшит i до 2
17+ var i = 3 ;
18+
19+ alert (i-- ); // shows 3, decreases i to 2
1920
20- alert (i-- ) // выведет 2, затем уменьшит i до 1
21+ alert (i-- ) // shows 2, decreases i to 1
2122
22- alert (i-- ) // выведет 1, затем уменьшит i до 0
23+ alert (i-- ) // shows 1, decreases i to 0
2324
24- // все, проверка while(i) не даст выполняться циклу дальше
25+ // done, while(i) check stops the loop
2526```
2627
Original file line number Diff line number Diff line change 1- # Последнее значение цикла
1+ # Last loop value
22
33[ importance 3]
44
5- Какое последнее значение выведет этот код? Почему ?
5+ What is be the last value alerted by this code? Why ?
66
77``` js
88var i = 3 ;
You can’t perform that action at this time.
0 commit comments