Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- 다트기초문법
- 티스토리챌린지
- 스위프트프로그래밍
- testautomation
- robotframework
- 테킷앱스쿨
- 스위프트
- dartlang
- playwright
- 파이썬자동화
- 테스트자동화
- iOS프로그래밍
- 오블완
- 다트
- 다트언어
- Flutter
- 야곰스위프트
- DART
- SWIFT
- Python
- Swift5
- ios개발
- 다트기본문법
- pythonautomation
- 로봇프레임워크
- 테스트오토메이션
- 스위프트개발
- 플러터
- qaautomation
- QA자동화
Archives
- Today
- Total
day_by_day
2. Loop 본문
기본 for loop
//0부터 9까지 출력
void main() {
for(int i=0; i<10; i++){
print(i);
}
}
List 순회
- 기본 for loop
void main(){
int total = 0;
List<int> nums = [1,2,3,4,5,6];
for(int i = 0; i < nums.length; i++){
total += nums\[i\];
}
print(total);
}
- for in loop
void main(){
total = 0;
for(int num in nums){
total += num;
}
print(total);
}
while loop
void main(){
int total = 0;
while(total < 10){
total +=1;
}
print(total);
}
do-while loop
- do-while 문은 거의 사용하지 않음
void main(){
int total = 0;
do{
total +=1;
}while(total < 10);
print(total);
}
loop 안에서 break, continue
- break
void main(){
int total = 0;
while(total < 10){
total +=1;
if(total == 5){
break;
}
}
print(total);
}
- continue
void main(){
for(int i =0; i<10; i++){
if(i == 5){
continue; // 현재 루프만 스킵
}
print(i);
}
}
'QA Automation > dart' 카테고리의 다른 글
6. Map (1) | 2023.05.15 |
---|---|
5. List (3) | 2023.05.15 |
4. 열거형 Enum (0) | 2023.05.15 |
3. Set (1) | 2023.05.15 |
1. 기본(null, const, final, operator, if, switch) (0) | 2023.05.15 |