ver. Swift 5.3.2
備忘録: Swift 値の入出力
入力受け取り
// -> Hello, World!!
let tmp = readLine()!
// -> 19990809
var my_birth = Int(readLine()!)!
// -> 20210518
my_birth = Int(readLine()!)! // <- update value
// 複数行の場合
// -> John/Bob/Alice/Billy
let employee: [String] = readLine()!.components(separatedBy: "/")
// -> 34 29 21 23
let age: [Int] = readLine()!.components(separatedBy: " ").map { Int($0)! }
出力
// print(***)での出力は改行が入ります。
print(tmp)
// -> Hello, World!!
print(my_birth)
// -> 20210518
print(employee[0] + " " + age[0])
// -> John 34