강의

멘토링

커뮤니티

Inflearn Community Q&A

ehfpal97699994's profile image
ehfpal97699994

asked

[Code Factory] [Introduction] Completely master the Dart language in 4 hours

Dart #1 Fundamentals

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함수형-프로그래밍객체지향

Answer 1

0

codefactory님의 프로필 이미지
codefactory
Instructor

안녕하세요!

맞습니다!

감사합니다!

ehfpal97699994's profile image
ehfpal97699994

asked

Ask a question