같은 반복문을 while 과 for 로 각각 작성
int i = 0; //반복문에서 횟수 카운트 변수 i
while(i < 3) {
System.out.println(2);
System.out.println(3);
i++;
}
// 2
// 3
// 2
// 3
// 2
// 3
for(int i=0; i<3; i++) {
System.out.println(2);
System.out.println(3);
}
'시작 전' 카테고리의 다른 글
제어문 - 배열과 반복문 (0) | 2022.07.08 |
---|---|
제어문 - 연산자 (0) | 2022.07.07 |
제어문 - 조건문 (0) | 2022.07.07 |
App 만들기 - 기본기능 (0) | 2022.07.01 |
arguments & parameter (0) | 2022.06.30 |