Inflearn Community Q&A
for loop
Written on
·
406
0
void main() {
int total = 0;
for (int i = 0; i < 10; i++) {
total += 1;
if (total == 5) {
break;
}
}
print(total);
}
->5
여기서 0이였던 i 값이 1(i++)이되고 total 은 1이 되며(total+=1)
또 반복으로 i 값이 2가되고 total 은 2가 되고
쭉 반복되어 total 이 5가되었을때 나와서 출력된거맞나요?
flutter함수형-프로그래밍객체지향





