본문 바로가기
Programming/Java

7 while loop (feat. do-while)

by Dowon Kang 2024. 1. 7.

1. while Loop

The while loop is a control flow statement that repeatedly executes a block of code as long as a specified condition is true. 

 

 

 


 


2. do-while Loop

The do-while loop is similar to the while loop, but the condition is evaluated after the loop body. This guarantees that the loop body is executed at least once, regardless of whether the condition is initially true or false.

 

 

 

 

'Programming > Java' 카테고리의 다른 글

9 Two-dimensional Arrays (Feat. Object Array)  (0) 2024.01.19
8 Array (배열)  (0) 2024.01.19
6 for loop (feat. Nested, foreach)  (0) 2024.01.07
5 If & Switch (feat. break, continue)  (0) 2024.01.07
4 Operation (연산)  (1) 2023.12.30

댓글