[Day1-2] a와 b 출력하기
문제

내 정답 코드
import Foundation
let n = readLine()!.components(separatedBy: " ").map { Int($0)! }
let (a, b) = (n[0], n[1])
var string = "a = \(a)\nb = \(b)"
print(string)
#
띄워쓰기라는 separator을 파라미터로 준 components를 사용하여 배열로 반환하였는데 그 과정에서 map을 통해 Int값으로 형변환을 해주었다.
배운 기술
0. print
https://developer.apple.com/documentation/swift/print(_:separator:terminator:)
print(_:separator:terminator:) | Apple Developer Documentation
Writes the textual representations of the given items into the standard output.
developer.apple.com
1. components(separatedBy: )
https://developer.apple.com/documentation/foundation/nsstring/1413214-components
components(separatedBy:) | Apple Developer Documentation
Returns an array containing substrings from the receiver that have been divided by a given separator.
developer.apple.com
(+separator 구분자)
2. map { }
https://developer.apple.com/documentation/swift/array/map(_:)-87c4d
map(_:) | Apple Developer Documentation
Returns an array containing the results of mapping the given closure over the sequence’s elements.
developer.apple.com