Java Tutorial/Statement Control/Do While Loop — различия между версиями

Материал из Java эксперт
Перейти к: навигация, поиск
 
м (1 версия)
 
(нет различий)

Текущая версия на 05:19, 1 июня 2010

The do while loop in action

do {
  // statements
} while (expression);



sum = 210


The do-while Statement

The do-while statement is like the while statement, except that the associated block always gets executed at least once.

Its syntax is as follows:



do {
    statement (s)
} while (booleanExpression);



This prints the following on the console.

4