[swift] 반복문

corncheese·2021년 7월 20일
0

swift

목록 보기
9/9
  1. for-in 구문
  • 기존 언어의 for-each 구문과 유사하다.
  • Dictionary의 경우 이터레이션 아이템으로 튜플이 들어온다.
for item in items{
}
  1. while 구문
while integers.count > 1{
	integers.removeLast()
}
  1. repeat- while 구문
  • 기존 언어의 do-while과 형태/동작이 유사하다.
repeat{
 //실행구문
}while 조건

repeat {
    integers.removeLast()
} while integers.count > 0

0개의 댓글