[SWIFT] 읽고 쓰기

힐링힐링·2023년 9월 18일
0

알고리즘

목록 보기
2/7

readLine()은 input을 읽어 오고
.components(seraratedBy:[""]) 는 구분자

let n = readLine()!.components(separatedBy: [" "])

input : 4 5
=> ["4","5"]

map{Int($0)!} map형태로 바꾸며 첫번째 인자를 Int형으로

let n = readLine()!.components(separatedBy: [" "]).map{Int($0)!}

input : 4 5
=> [4,5]

profile
블로그 이전합니다 https://james-kim-tech.tistory.com/

0개의 댓글