Notice
Recent Posts
Recent Comments
Link
관리 메뉴

김종권의 iOS 앱 개발 알아가기

[iOS - swift] for - in - where 문법 본문

iOS 기본 (swift)

[iOS - swift] for - in - where 문법

jake-kim 2020. 11. 7. 11:28

For문을 사용하되, 특정 조건인 경우를 확인할 때 사용

  • where없이 사용
for data in dataSource {
	if data.name == "jake" {
    	print(jake existed)
        return
    }
}
  • where있이 사용: if문이 없어지고 더욱 간결
for data in dataSource where data.name == "jake" {
    print(jake existed)
    return
}

 

Comments