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
}