[SWIFT] forEach

힐링힐링·2023년 10월 1일
0

SWIFT 문법

목록 보기
8/26

forEach

func forEach(_ body: (Self.Element) throws -> Void) rethrows

arr.forEach{} 배열 순회

let numberWords = ["one", "two", "three"]
for word in numberWords {
    print(word)
}
// Prints "one"
// Prints "two"
// Prints "three"

//위와 같은 결과
numberWords.forEach { word in print(word)
}
profile
블로그 이전합니다 https://james-kim-tech.tistory.com/

0개의 댓글