앱/iOS(Swift)

[Swift] while, repeat while 차이

리드맥 2022. 1. 23. 21:44
  • 조건문이 맞으면 실행
var a = 3
var b = 6

while a < b {
  print(a)
  a = a + 1
}

3
4
5

  • 조건문이 틀려도 무조건 한번은 실행
repeat{
    print(a)
    a = a + 1
} while a > b

3