Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок+ 1
int x = 3; while(x > 0) { System.out.println(x); x--; } /* Outputs 3 2 1 */
in this code, shouldn't the value of x remain 3 when it is compared with 0 for the 2nd time as it is post decrement.
1 ответ
0
on line x-- , it will be 3..post that line, x becomes 2..